Skip to content

Commit ff3368a

Browse files
committed
fix a leak problem
1 parent ce25734 commit ff3368a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tcp_listener.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ func (this *TcpListener) acceptLoop(ctx context.Context) {
166166
newTcpConn.Start(ctx, this.netMgrWg, func(connection Connection) {
167167
if this.handler != nil {
168168
this.handler.OnConnectionDisconnect(this, connection)
169-
this.connectionMapLock.Lock()
170-
delete(this.connectionMap, connection.GetConnectionId())
171-
this.connectionMapLock.Unlock()
172169
}
170+
this.connectionMapLock.Lock()
171+
delete(this.connectionMap, connection.GetConnectionId())
172+
this.connectionMapLock.Unlock()
173173
})
174174
if this.handler != nil {
175175
this.handler.OnConnectionConnected(this, newTcpConn)

0 commit comments

Comments
 (0)