Skip to content

Commit 5573a1b

Browse files
committed
close scope for manetConnWithScope
1 parent 87125fc commit 5573a1b

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

p2p/transport/tcpreuse/connwithscope.go

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ func (c connWithScope) Scope() network.ConnManagementScope {
1717
return c.scope
1818
}
1919

20+
func (c *connWithScope) Close() error {
21+
c.scope.Done()
22+
return c.ManetTCPConnInterface.Close()
23+
}
24+
2025
func manetConnWithScope(c manet.Conn, scope network.ConnManagementScope) (manet.Conn, error) {
2126
if tcpconn, ok := c.(sampledconn.ManetTCPConnInterface); ok {
2227
return &connWithScope{tcpconn, scope}, nil

p2p/transport/tcpreuse/listener.go

+1
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ func (m *multiplexedListener) run() error {
260260
select {
261261
case demux.buffer <- connWithScope:
262262
case <-ctx.Done():
263+
log.Debug("accept queue full; dropping connection from: %v", connWithScope.RemoteMultiaddr())
263264
connWithScope.Close()
264265
}
265266
}()

0 commit comments

Comments
 (0)