0
0
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 13:21:00 +02:00

make sure to close connection

This commit is contained in:
Zack Scholl 2018-09-24 16:05:34 -07:00
parent f56d5c797c
commit 7df06272b8
2 changed files with 3 additions and 1 deletions

View file

@ -329,6 +329,7 @@ func connectToTCPServer(room string, address string) (com comm.Comm, err error)
if err != nil {
return
}
defer connection.Close()
connection.SetReadDeadline(time.Now().Add(3 * time.Hour))
connection.SetDeadline(time.Now().Add(3 * time.Hour))
connection.SetWriteDeadline(time.Now().Add(3 * time.Hour))

View file

@ -306,10 +306,11 @@ func connectToTCPServer(room string, address string) (com comm.Comm, err error)
if err != nil {
return
}
defer connection.Close()
connection.SetReadDeadline(time.Now().Add(3 * time.Hour))
connection.SetDeadline(time.Now().Add(3 * time.Hour))
connection.SetWriteDeadline(time.Now().Add(3 * time.Hour))
com = comm.New(connection)
ok, err := com.Receive()
if err != nil {