@cryptotaxi247 / kubo / commits / 80ec51f12

Added last step of negotiation.

Brendan Mc committed Sep 3, 2014 at 21:38 UTC 80ec51f12942e8f21ab4e5f7aec3757993e58e2e
1 file changed +9
identify/identify.go
+9
@@ -226,6 +226,15 @@ func Handshake(self, remote *peer.Peer, in, out chan []byte) (chan []byte, chan
226 }
227 }()
228
229 + finished := []byte("Finished")
230 +
231 + secureOut <- finished
232 + resp2 := <-secureIn
233 +
234 + if bytes.Compare(resp2, finished) != 0 {
235 + return nil, nil, errors.New("Negotiation failed.")
236 + }
237 +
238 u.DOut("[%s] identify: Got node id: %s\n", self.ID.Pretty(), remote.ID.Pretty())
239
240 return secureIn, secureOut, nil