File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -1354,6 +1354,13 @@ func (u *StdConn) getMemInfo(meminfo *[unix.SK_MEMINFO_VARS]uint32) error {
13541354}
13551355
13561356func (u * StdConn ) Close () error {
1357+ // Attempt to unblock any outstanding sendmsg/sendmmsg calls so the shard
1358+ // workers can drain promptly during shutdown. Ignoring errors here is fine
1359+ // because some platforms/kernels may not support shutdown on UDP sockets.
1360+ if err := unix .Shutdown (u .sysFd , unix .SHUT_WR ); err != nil && err != unix .ENOTCONN && err != unix .EINVAL && err != unix .EBADF {
1361+ u .l .WithError (err ).Debug ("Failed to shutdown UDP socket for close" )
1362+ }
1363+
13571364 var flushErr error
13581365 for _ , shard := range u .sendShards {
13591366 if shard == nil {
You can’t perform that action at this time.
0 commit comments