mirror of
https://github.com/slackhq/nebula.git
synced 2026-02-16 01:34:22 +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 {
|
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
|
var flushErr error
|
||||||
for _, shard := range u.sendShards {
|
for _, shard := range u.sendShards {
|
||||||
if shard == nil {
|
if shard == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user