@@ -282,7 +282,7 @@ pub const Request = struct {
282282 };
283283 }
284284
285- loop .connect (AsyncHandlerT , async_handler , & async_handler .read_completion , AsyncHandlerT .connected , socket , address );
285+ try loop .connect (AsyncHandlerT , async_handler , & async_handler .read_completion , AsyncHandlerT .connected , socket , address );
286286 }
287287
288288 // Does additional setup of the request for the firsts (i.e. non-redirect) call.
@@ -490,7 +490,6 @@ fn AsyncHandler(comptime H: type, comptime L: type) type {
490490 }
491491
492492 fn connected (self : * Self , _ : * IO.Completion , result : IO .ConnectError ! void ) void {
493- self .loop .onConnect (result );
494493 result catch | err | return self .handleError ("Connection failed" , err );
495494 self .connection .connected () catch | err | {
496495 self .handleError ("connected handler error" , err );
@@ -518,11 +517,12 @@ fn AsyncHandler(comptime H: type, comptime L: type) type {
518517 sent ,
519518 self .socket ,
520519 node .data ,
521- );
520+ ) catch | err | {
521+ self .handleError ("loop send error" , err );
522+ };
522523 }
523524
524525 fn sent (self : * Self , _ : * IO.Completion , n_ : IO .SendError ! usize ) void {
525- self .loop .onSend (n_ );
526526 const n = n_ catch | err | {
527527 return self .handleError ("Write error" , err );
528528 };
@@ -548,7 +548,9 @@ fn AsyncHandler(comptime H: type, comptime L: type) type {
548548 sent ,
549549 self .socket ,
550550 next_ .data ,
551- );
551+ ) catch | err | {
552+ self .handleError ("loop send error" , err );
553+ };
552554 return ;
553555 }
554556
@@ -567,18 +569,19 @@ fn AsyncHandler(comptime H: type, comptime L: type) type {
567569 }
568570
569571 self .is_receiving = true ;
570- return self .loop .recv (
572+ self .loop .recv (
571573 Self ,
572574 self ,
573575 & self .read_completion ,
574576 Self .received ,
575577 self .socket ,
576578 self .read_buf [self .read_pos .. ],
577- );
579+ ) catch | err | {
580+ self .handleError ("loop recv error" , err );
581+ };
578582 }
579583
580584 fn received (self : * Self , _ : * IO.Completion , n_ : IO .RecvError ! usize ) void {
581- self .loop .onRecv (n_ );
582585 self .is_receiving = false ;
583586 const n = n_ catch | err | {
584587 return self .handleError ("Read error" , err );
0 commit comments