0
0
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 13:21:00 +02: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) delete(r.connections.potentialReceivers, key)
r.connections.Unlock() r.connections.Unlock()
logger.Debug("deleted sender and receiver") 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) { if r.connections.IsPotentialReceiverConnected(key) {
sendMessage("no", connection) sendMessage("no", connection)
return return
@ -236,7 +237,7 @@ func receiveMessage(connection net.Conn) string {
"ip": connection.RemoteAddr().String(), "ip": connection.RemoteAddr().String(),
}) })
messageByte := make([]byte, BUFFERSIZE) 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 { if err != nil {
logger.Warn(err) logger.Warn(err)
} }