mirror of
https://github.com/slackhq/nebula.git
synced 2025-11-23 00:44:25 +01:00
fix hang on exit
This commit is contained in:
@@ -1354,6 +1354,13 @@ func (u *StdConn) getMemInfo(meminfo *[unix.SK_MEMINFO_VARS]uint32) error {
|
||||
}
|
||||
|
||||
func (u *StdConn) Close() error {
|
||||
// Attempt to unblock any outstanding sendmsg/sendmmsg calls so the shard
|
||||
// workers can drain promptly during shutdown. Ignoring errors here is fine
|
||||
// because some platforms/kernels may not support shutdown on UDP sockets.
|
||||
if err := unix.Shutdown(u.sysFd, unix.SHUT_WR); err != nil && err != unix.ENOTCONN && err != unix.EINVAL && err != unix.EBADF {
|
||||
u.l.WithError(err).Debug("Failed to shutdown UDP socket for close")
|
||||
}
|
||||
|
||||
var flushErr error
|
||||
for _, shard := range u.sendShards {
|
||||
if shard == nil {
|
||||
|
||||
Reference in New Issue
Block a user