TUN-8374: Close UDP socket if registration fails
If cloudflared was unable to register the UDP session with the edge, the socket would be left open to be eventually closed by the OS, or garbage collected by the runtime. Considering that either of these closes happened significantly after some delay, it was causing cloudflared to hold open file descriptors longer than usual if continuously unable to register sessions.
This commit is contained in:
parent
84833011ec
commit
1b02d169ad
|
@ -324,6 +324,7 @@ func (q *QUICConnection) RegisterUdpSession(ctx context.Context, sessionID uuid.
|
|||
|
||||
session, err := q.sessionManager.RegisterSession(ctx, sessionID, originProxy)
|
||||
if err != nil {
|
||||
originProxy.Close()
|
||||
log.Err(err).Str("sessionID", sessionID.String()).Msgf("Failed to register udp session")
|
||||
tracing.EndWithErrorStatus(registerSpan, err)
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue