@@ -134,15 +134,15 @@ static void
134
134
connect_send_cb (isc_nmhandle_t * handle , isc_result_t result , void * arg ) {
135
135
csdata_t data ;
136
136
137
- REQUIRE (VALID_NMHANDLE (handle ));
138
-
139
137
(void )atomic_fetch_sub (& active_cconnects , 1 );
140
138
memmove (& data , arg , sizeof (data ));
141
139
isc_mem_put (data .mctx , arg , sizeof (data ));
142
140
if (result != ISC_R_SUCCESS ) {
143
141
goto error ;
144
142
}
145
143
144
+ REQUIRE (VALID_NMHANDLE (handle ));
145
+
146
146
result = isc__nm_http_request (handle , & data .region , data .reply_cb ,
147
147
data .cb_arg );
148
148
if (result != ISC_R_SUCCESS ) {
@@ -675,39 +675,38 @@ doh_connect_thread(void *arg);
675
675
static void
676
676
doh_receive_send_reply_cb (isc_nmhandle_t * handle , isc_result_t eresult ,
677
677
isc_region_t * region , void * cbarg ) {
678
- isc_nmhandle_t * thandle = NULL ;
679
678
isc_nm_t * connect_nm = (isc_nm_t * )cbarg ;
680
679
680
+ if (eresult != ISC_R_SUCCESS ) {
681
+ return ;
682
+ }
683
+
681
684
assert_non_null (handle );
682
685
UNUSED (region );
683
686
684
- isc_nmhandle_attach (handle , & thandle );
685
- if (eresult == ISC_R_SUCCESS ) {
686
- int_fast64_t sends = atomic_fetch_sub (& nsends , 1 );
687
- atomic_fetch_add (& csends , 1 );
688
- atomic_fetch_add (& creads , 1 );
689
- if (sends > 0 && connect_nm != NULL ) {
690
- size_t i ;
691
- for (i = 0 ; i < NWRITES / 2 ; i ++ ) {
692
- eresult = isc__nm_http_request (
693
- handle ,
694
- & (isc_region_t ){
695
- .base = (uint8_t * )send_msg .base ,
696
- .length = send_msg .len },
697
- doh_receive_send_reply_cb , NULL );
698
- if (eresult == ISC_R_CANCELED ) {
699
- break ;
700
- }
701
- assert_true (eresult == ISC_R_SUCCESS );
687
+ int_fast64_t sends = atomic_fetch_sub (& nsends , 1 );
688
+ atomic_fetch_add (& csends , 1 );
689
+ atomic_fetch_add (& creads , 1 );
690
+ if (sends > 0 && connect_nm != NULL ) {
691
+ size_t i ;
692
+ for (i = 0 ; i < NWRITES / 2 ; i ++ ) {
693
+ eresult = isc__nm_http_request (
694
+ handle ,
695
+ & (isc_region_t ){
696
+ .base = (uint8_t * )send_msg .base ,
697
+ .length = send_msg .len },
698
+ doh_receive_send_reply_cb , NULL );
699
+ if (eresult == ISC_R_CANCELED ) {
700
+ break ;
702
701
}
703
-
704
- isc_job_run (loopmgr , doh_connect_thread , connect_nm );
705
- }
706
- if (sends <= 0 ) {
707
- isc_loopmgr_shutdown (loopmgr );
702
+ assert_true (eresult == ISC_R_SUCCESS );
708
703
}
704
+
705
+ isc_job_run (loopmgr , doh_connect_thread , connect_nm );
706
+ }
707
+ if (sends <= 0 ) {
708
+ isc_loopmgr_shutdown (loopmgr );
709
709
}
710
- isc_nmhandle_detach (& thandle );
711
710
}
712
711
713
712
static void
0 commit comments