1
0
mirror of https://github.com/schollz/croc.git synced 2024-11-24 08:02:33 +03:00

Fix bug in relay

This commit is contained in:
Zack Scholl 2017-10-21 15:54:51 -06:00
parent cb3f94880d
commit 3bb5f43c07

View File

@ -177,7 +177,8 @@ func (r *Relay) clientCommuncation(id int, connection net.Conn) {
delete(r.connections.potentialReceivers, key)
r.connections.Unlock()
logger.Debug("deleted sender and receiver")
} else if connectionType == "r" { //receiver connection "r"
} else if connectionType == "r" || connectionType == "c" {
//receiver
if r.connections.IsPotentialReceiverConnected(key) {
sendMessage("no", connection)
return
@ -236,7 +237,7 @@ func receiveMessage(connection net.Conn) string {
"ip": connection.RemoteAddr().String(),
})
messageByte := make([]byte, BUFFERSIZE)
err := connection.SetDeadline(time.Now().Add(30 * time.Second))
err := connection.SetDeadline(time.Now().Add(60 * time.Minute))
if err != nil {
logger.Warn(err)
}