@@ -605,6 +605,7 @@ impl<Front: SocketHandler> ConnectionH2<Front> {
605
605
priorities. sort ( ) ;
606
606
607
607
println_ ! ( "PRIORITIES: {priorities:?}" ) ;
608
+ let mut socket_write = false ;
608
609
' outer: for stream_id in priorities {
609
610
let global_stream_id = * self . streams . get ( stream_id) . unwrap ( ) ;
610
611
let stream = & mut context. streams [ global_stream_id] ;
@@ -621,6 +622,7 @@ impl<Front: SocketHandler> ConnectionH2<Front> {
621
622
debug_kawa ( kawa) ;
622
623
}
623
624
while !kawa. out . is_empty ( ) {
625
+ socket_write = true ;
624
626
let bufs = kawa. as_io_slice ( ) ;
625
627
let ( size, status) = self . socket . socket_write_vectored ( & bufs) ;
626
628
kawa. consume ( size) ;
@@ -670,7 +672,11 @@ impl<Front: SocketHandler> ConnectionH2<Front> {
670
672
self . streams . remove ( & stream_id) . unwrap ( ) ;
671
673
}
672
674
673
- if self . expect_write . is_none ( ) {
675
+ if self . socket . socket_wants_write ( ) {
676
+ if !socket_write {
677
+ self . socket . socket_write ( & [ ] ) ;
678
+ }
679
+ } else if self . expect_write . is_none ( ) {
674
680
// We wrote everything
675
681
self . readiness . interest . remove ( Ready :: WRITABLE ) ;
676
682
}
@@ -1045,7 +1051,12 @@ impl<Front: SocketHandler> ConnectionH2<Front> {
1045
1051
match self . position {
1046
1052
Position :: Client ( _, _, BackendStatus :: KeepAlive ) => unreachable ! ( ) ,
1047
1053
Position :: Client ( ..) => { }
1048
- Position :: Server => unreachable ! ( ) ,
1054
+ Position :: Server => {
1055
+ println_ ! ( "H2 SENDING CLOSE NOTIFY" ) ;
1056
+ self . socket . socket_close ( ) ;
1057
+ let _ = self . socket . socket_write_vectored ( & [ ] ) ;
1058
+ return ;
1059
+ }
1049
1060
}
1050
1061
// reconnection is handled by the server for each stream separately
1051
1062
for global_stream_id in self . streams . values ( ) {
0 commit comments