Audrius Butkevicius 10 лет назад
Родитель
Сommit
5cfb578170
1 измененных файлов с 2 добавлено и 0 удалено
  1. 2 0
      cmd/syncthing/tls.go

+ 2 - 0
cmd/syncthing/tls.go

@@ -102,7 +102,9 @@ func (l *DowngradingListener) Accept() (net.Conn, error) {
 	}
 
 	br := bufio.NewReader(conn)
+	conn.SetReadDeadline(time.Now().Add(1 * time.Second))
 	bs, err := br.Peek(1)
+	conn.SetReadDeadline(time.Time{})
 	if err != nil {
 		// We hit a read error here, but the Accept() call succeeded so we must not return an error.
 		// We return the connection as is and let whoever tries to use it deal with the error.