fix: don't abort accept when accepting a single connection fails
@@ -23,13 +23,14 @@ func (r *Relay) Listener() *RelayListener {
}
func (l *RelayListener) Accept() (manet.Conn, error) {
+ for {
select {
case c := <-l.incoming:
err := l.Relay().writeResponse(c.stream, pb.CircuitRelay_SUCCESS)
if err != nil {
log.Debugf("error writing relay response: %s", err.Error())
c.stream.Reset()
- return nil, err
+ continue
}
// TODO: Pretty print.
@@ -41,6 +42,7 @@ func (l *RelayListener) Accept() (manet.Conn, error) {
return nil, l.ctx.Err()
}
}
+}
func (l *RelayListener) Addr() net.Addr {
return &NetAddr{
