From d0229b62da65e1bb128ef0d102edf7592c8ef8d0 Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Fri, 17 Jul 2015 22:04:02 +0100 Subject: [PATCH] Fix bugs --- cmd/relaysrv/protocol_listener.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/relaysrv/protocol_listener.go b/cmd/relaysrv/protocol_listener.go index 1e18b156e..c3321aa50 100644 --- a/cmd/relaysrv/protocol_listener.go +++ b/cmd/relaysrv/protocol_listener.go @@ -166,9 +166,13 @@ func protocolConnectionHandler(tcpConn net.Conn, config *tls.Config) { // Potentially closing a second time. close(outbox) conn.Close() - outboxesMut.Lock() - delete(outboxes, id) - outboxesMut.Unlock() + // Only delete the outbox if the client join, as it migth be a + // lookup request coming from the same client. + if joined { + outboxesMut.Lock() + delete(outboxes, id) + outboxesMut.Unlock() + } return case <-pingTicker.C: if !joined {