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 {
610610func (s * UDPSession ) postProcess () {
611611 txqueue := make ([]ipv4.Message , 0 , acceptBacklog )
612612 chCork := make (chan struct {}, 1 )
613+ chDie := s .die
613614
614615 for {
615616 select {
@@ -668,6 +669,9 @@ func (s *UDPSession) postProcess() {
668669 }
669670 }
670671
672+ // re-enable die channel
673+ chDie = s .die
674+
671675 case <- chCork : // emulate a corked socket
672676 if len (txqueue ) > 0 {
673677 s .tx (txqueue )
@@ -679,7 +683,15 @@ func (s *UDPSession) postProcess() {
679683 txqueue = txqueue [:0 ]
680684 }
681685
682- case <- s .die :
686+ // re-enable 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 temporarily
693+ continue
694+ }
683695 return
684696 }
685697 }
You can’t perform that action at this time.
0 commit comments