aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Borg <jakob@kastelo.net>2023-07-27 00:55:48 +0200
committerGitHub <noreply@github.com>2023-07-26 23:55:48 +0100
commit319916124bda1fb9a7a68607dd03b550f8a7f590 (patch)
treee962568a42c108d17fc5ac55cc68285f116d6af2
parentb08b99e284ca1027608ded399802e42e2acc5180 (diff)
downloadsyncthing-319916124bda1fb9a7a68607dd03b550f8a7f590.tar.gz
syncthing-319916124bda1fb9a7a68607dd03b550f8a7f590.zip
cmd/strelaysrv: Handle accept error with debug set (fixes #9001) (#9004)
-rw-r--r--cmd/strelaysrv/listener.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/cmd/strelaysrv/listener.go b/cmd/strelaysrv/listener.go
index dc3724c0f..c89f8a2c8 100644
--- a/cmd/strelaysrv/listener.go
+++ b/cmd/strelaysrv/listener.go
@@ -36,8 +36,14 @@ func listener(_, addr string, config *tls.Config, token string) {
for {
conn, isTLS, err := listener.AcceptNoWrapTLS()
if err != nil {
+ // Conn may be nil if accept failed, or non-nil if the initial
+ // read to figure out if it's TLS or not failed. In the latter
+ // case, close the connection before moving on.
+ if conn != nil {
+ conn.Close()
+ }
if debug {
- log.Println("Listener failed to accept connection from", conn.RemoteAddr(), ". Possibly a TCP Ping.")
+ log.Println("Listener failed to accept:", err)
}
continue
}