Skip to content

Commit

Permalink
fix: Fix receiver pool not cleaning up connections in some instances …
Browse files Browse the repository at this point in the history
…and preventing shutdown, and add additional logs
  • Loading branch information
driskell committed Feb 26, 2024
1 parent fcd54d6 commit f072865
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions lc-lib/receiver/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ ReceiverLoop:
if shutdownChan == nil && len(r.receivers) == 0 && len(r.connectionStatus) == 0 {
break ReceiverLoop
}
log.Info("Receiver pool waiting on %d connections to close", len(r.connectionStatus))
}
case *transports.PingEvent:
// Immediately send a pong back - ignore failure - remote will time itself out
Expand Down
4 changes: 2 additions & 2 deletions lc-lib/transports/tcp/receivertcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func (t *receiverTCP) connectionRoutine(socket net.Conn, conn *connection) {

didStart := false
if err := conn.run(func() {
conn.sendEvent(transports.NewConnectEvent(conn.ctx, socket.RemoteAddr().String(), conn.socket.Desc()))
t.eventChan <- transports.NewConnectEvent(conn.ctx, socket.RemoteAddr().String(), conn.socket.Desc())
didStart = true
}); err != nil {
if err == ErrHardCloseRequested {
Expand All @@ -256,7 +256,7 @@ func (t *receiverTCP) connectionRoutine(socket net.Conn, conn *connection) {
}

if didStart {
conn.sendEvent(transports.NewDisconnectEvent(conn.ctx, socket.RemoteAddr().String(), conn.socket.Desc()))
t.eventChan <- transports.NewDisconnectEvent(conn.ctx, socket.RemoteAddr().String(), conn.socket.Desc())
}

t.connMutex.Lock()
Expand Down

0 comments on commit f072865

Please sign in to comment.