[client] fix/proxy close (#2873)

When the remote peer switches the Relay instance then must to close the proxy connection to the old instance.

It can cause issues when the remote peer switch connects to the Relay instance multiple times and then reconnects to an instance it had previously connected to.
This commit is contained in:
Zoltan Papp
2024-11-11 14:18:38 +01:00
committed by GitHub
parent b4d7605147
commit 30f025e7dd
8 changed files with 26 additions and 16 deletions

View File

@ -2,7 +2,7 @@ package server
import (
"context"
"io"
"errors"
"net"
"sync"
"time"
@ -57,7 +57,7 @@ func (p *Peer) Work() {
for {
n, err := p.conn.Read(buf)
if err != nil {
if err != io.EOF {
if !errors.Is(err, net.ErrClosed) {
p.log.Errorf("failed to read message: %s", err)
}
return