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:
parent
cb3f94880d
commit
3bb5f43c07
1 changed files with 3 additions and 2 deletions
5
relay.go
5
relay.go
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue