@@ -168,7 +168,7 @@ func (b *Bzz) APIs() []rpc.API {
168168func (b * Bzz ) RunProtocol (spec * protocols.Spec , run func (* BzzPeer ) error ) func (* p2p.Peer , p2p.MsgReadWriter ) error {
169169 return func (p * p2p.Peer , rw p2p.MsgReadWriter ) error {
170170 // wait for the bzz protocol to perform the handshake
171- handshake , _ := b .GetHandshake (p .ID ())
171+ handshake , _ := b .GetOrCreateHandshake (p .ID ())
172172 defer b .removeHandshake (p .ID ())
173173 select {
174174 case <- handshake .done :
@@ -213,7 +213,7 @@ func (b *Bzz) performHandshake(p *protocols.Peer, handshake *HandshakeMsg) error
213213// runBzz is the p2p protocol run function for the bzz base protocol
214214// that negotiates the bzz handshake
215215func (b * Bzz ) runBzz (p * p2p.Peer , rw p2p.MsgReadWriter ) error {
216- handshake , _ := b .GetHandshake (p .ID ())
216+ handshake , _ := b .GetOrCreateHandshake (p .ID ())
217217 if ! <- handshake .init {
218218 return fmt .Errorf ("%08x: bzz already started on peer %08x" , b .localAddr .Over ()[:4 ], p .ID ().Bytes ()[:4 ])
219219 }
@@ -303,7 +303,7 @@ func (b *Bzz) removeHandshake(peerID enode.ID) {
303303}
304304
305305// GetHandshake returns the bzz handhake that the remote peer with peerID sent
306- func (b * Bzz ) GetHandshake (peerID enode.ID ) (* HandshakeMsg , bool ) {
306+ func (b * Bzz ) GetOrCreateHandshake (peerID enode.ID ) (* HandshakeMsg , bool ) {
307307 b .mtx .Lock ()
308308 defer b .mtx .Unlock ()
309309 handshake , found := b .handshakes [peerID ]
0 commit comments