mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-16 18:41:59 -07:00
Merge pull request #2126 from AudriusButkevicius/peek
Add timeout for peek (fixes #1035)
This commit is contained in:
commit
d75d162058
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user