From d25d29578451dc1bbe6e24a4819d3bdfcea58326 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Fri, 27 Mar 2015 12:17:28 +0000 Subject: [PATCH] refactor: small tweak for consistency --- router/handshake.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/router/handshake.go b/router/handshake.go index ccb638bb..0d6f37e8 100644 --- a/router/handshake.go +++ b/router/handshake.go @@ -114,8 +114,8 @@ func (conn *LocalConnection) handshake(enc *gob.Encoder, dec *gob.Decoder, accep } conn.uid = localConnID ^ remoteConnID + remotePublicStr, rpErr := fv.Value("PublicKey") if usingPassword { - remotePublicStr, rpErr := fv.Value("PublicKey") if rpErr != nil { return rpErr } @@ -131,7 +131,7 @@ func (conn *LocalConnection) handshake(enc *gob.Encoder, dec *gob.Decoder, accep conn.tcpSender = NewEncryptedTCPSender(enc, conn) conn.Decryptor = NewNaClDecryptor(conn) } else { - if _, found := handshakeRecv["PublicKey"]; found { + if rpErr == nil { return fmt.Errorf("Remote network is encrypted. Password required.") } conn.tcpSender = NewSimpleTCPSender(enc)