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:
parent
f56d5c797c
commit
7df06272b8
2 changed files with 3 additions and 1 deletions
|
@ -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))
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue