aboutsummaryrefslogtreecommitdiff
path: root/src/receive.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/receive.go')
-rw-r--r--src/receive.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/receive.go b/src/receive.go
index cb53f80..3e88be3 100644
--- a/src/receive.go
+++ b/src/receive.go
@@ -95,23 +95,22 @@ func (device *Device) addToHandshakeQueue(
func (device *Device) RoutineReceiveIncomming(IPVersion int) {
logDebug := device.log.Debug
- logDebug.Println("Routine, receive incomming, started")
+ logDebug.Println("Routine, receive incomming, IP version:", IPVersion)
for {
// wait for bind
- logDebug.Println("Waiting for udp bind")
- device.net.mutex.Lock()
+ logDebug.Println("Waiting for UDP socket, IP version:", IPVersion)
+
device.net.update.Wait()
+ device.net.mutex.RLock()
bind := device.net.bind
- device.net.mutex.Unlock()
+ device.net.mutex.RUnlock()
if bind == nil {
continue
}
- logDebug.Println("LISTEN\n\n\n")
-
// receive datagrams until conn is closed
buffer := device.GetMessageBuffer()
@@ -427,6 +426,8 @@ func (device *Device) RoutineHandshake() {
err = peer.SendBuffer(packet)
if err == nil {
peer.TimerAnyAuthenticatedPacketTraversal()
+ } else {
+ logError.Println("Failed to send response to:", peer.String(), err)
}
case MessageResponseType: