Merge pull request #42 from anyproto/fix-peer-connection

This commit is contained in:
Mikhail Rakhmanov 2023-07-04 11:12:38 +02:00 committed by GitHub
commit ac8c8e4a31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -189,7 +189,7 @@ func (p *peer) openDrpcConn(ctx context.Context) (dconn *subConn, err error) {
tconn := connutil.NewLastUsageConn(conn)
bufSize := p.ctrl.DrpcConfig().Stream.MaxMsgSizeMb * (1 << 20)
return &subConn{
Conn: drpcconn.NewWithOptions(conn, drpcconn.Options{
Conn: drpcconn.NewWithOptions(tconn, drpcconn.Options{
Manager: drpcmanager.Options{
Reader: drpcwire.ReaderOptions{MaximumBufferSize: bufSize},
Stream: drpcstream.Options{MaximumBufferSize: bufSize},
@ -296,7 +296,7 @@ func (p *peer) gc(ttl time.Duration) (aliveCount int) {
continue
}
}
return len(p.active) + len(p.inactive)
return len(p.active) + len(p.inactive) + int(p.incomingCount.Load())
}
func (p *peer) Close() (err error) {