[tor-commits] [goptlib/master] Check for error of SetDeadline in DialOr.
dcf at torproject.org
dcf at torproject.org
Tue Mar 5 23:22:53 UTC 2019
commit 8af304d1828d2c735c612c1d338bc6ac4b0f40c8
Author: David Fifield <david at bamsoftware.com>
Date: Tue Mar 5 14:05:10 2019 -0700
Check for error of SetDeadline in DialOr.
https://bugs.torproject.org/15826
---
pt.go | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/pt.go b/pt.go
index cc0ed8c..c2895b8 100644
--- a/pt.go
+++ b/pt.go
@@ -932,7 +932,11 @@ func DialOr(info *ServerInfo, addr, methodName string) (*net.TCPConn, error) {
if err != nil {
return nil, err
}
- s.SetDeadline(time.Now().Add(5 * time.Second))
+ err = s.SetDeadline(time.Now().Add(5 * time.Second))
+ if err != nil {
+ s.Close()
+ return nil, err
+ }
err = extOrPortAuthenticate(s, info)
if err != nil {
s.Close()
@@ -943,7 +947,11 @@ func DialOr(info *ServerInfo, addr, methodName string) (*net.TCPConn, error) {
s.Close()
return nil, err
}
- s.SetDeadline(time.Time{})
+ err = s.SetDeadline(time.Time{})
+ if err != nil {
+ s.Close()
+ return nil, err
+ }
return s, nil
}
More information about the tor-commits
mailing list