1
0
mirror of https://github.com/schollz/croc.git synced 2024-11-24 16:23:47 +03: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 {