File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -610,6 +610,7 @@ func (s *UDPSession) Control(f func(conn net.PacketConn) error) error {
610
610
func (s * UDPSession ) postProcess () {
611
611
txqueue := make ([]ipv4.Message , 0 , acceptBacklog )
612
612
chCork := make (chan struct {}, 1 )
613
+ chDie := s .die
613
614
614
615
for {
615
616
select {
@@ -668,6 +669,9 @@ func (s *UDPSession) postProcess() {
668
669
}
669
670
}
670
671
672
+ // re-eanble die channel
673
+ chDie = s .die
674
+
671
675
case <- chCork : // emulate a corked socket
672
676
if len (txqueue ) > 0 {
673
677
s .tx (txqueue )
@@ -679,7 +683,15 @@ func (s *UDPSession) postProcess() {
679
683
txqueue = txqueue [:0 ]
680
684
}
681
685
682
- case <- s .die :
686
+ // re-eanble die channel
687
+ chDie = s .die
688
+
689
+ case <- chDie :
690
+ // remaining packets in txqueue should be sent out
691
+ if len (chCork ) > 0 || len (s .chPostProcessing ) > 0 {
692
+ chDie = nil // block chDie
693
+ continue
694
+ }
683
695
return
684
696
}
685
697
}
You can’t perform that action at this time.
0 commit comments