File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -460,25 +460,3 @@ func (r *eofSignal) Read(buf []byte) (int, error) {
460460 }
461461 return n , err
462462}
463-
464- func (peer * Peer ) PeerList () []interface {} {
465- peers := peer .otherPeers ()
466- ds := make ([]interface {}, 0 , len (peers ))
467- for _ , p := range peers {
468- p .infolock .Lock ()
469- addr := p .listenAddr
470- p .infolock .Unlock ()
471- // filter out this peer and peers that are not listening or
472- // have not completed the handshake.
473- // TODO: track previously sent peers and exclude them as well.
474- if p == peer || addr == nil {
475- continue
476- }
477- ds = append (ds , addr )
478- }
479- ourAddr := peer .ourListenAddr
480- if ourAddr != nil && ! ourAddr .IP .IsLoopback () && ! ourAddr .IP .IsUnspecified () {
481- ds = append (ds , ourAddr )
482- }
483- return ds
484- }
Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ func (bp *baseProtocol) handle(rw MsgReadWriter) error {
169169 case pongMsg :
170170
171171 case getPeersMsg :
172- peers := bp .peer . PeerList ()
172+ peers := bp .peerList ()
173173 // this is dangerous. the spec says that we should _delay_
174174 // sending the response if no new information is available.
175175 // this means that would need to send a response later when
@@ -264,3 +264,25 @@ func (bp *baseProtocol) handshakeMsg() Msg {
264264 bp .peer .ourID .Pubkey ()[1 :],
265265 )
266266}
267+
268+ func (bp * baseProtocol ) peerList () []interface {} {
269+ peers := bp .peer .otherPeers ()
270+ ds := make ([]interface {}, 0 , len (peers ))
271+ for _ , p := range peers {
272+ p .infolock .Lock ()
273+ addr := p .listenAddr
274+ p .infolock .Unlock ()
275+ // filter out this peer and peers that are not listening or
276+ // have not completed the handshake.
277+ // TODO: track previously sent peers and exclude them as well.
278+ if p == bp .peer || addr == nil {
279+ continue
280+ }
281+ ds = append (ds , addr )
282+ }
283+ ourAddr := bp .peer .ourListenAddr
284+ if ourAddr != nil && ! ourAddr .IP .IsLoopback () && ! ourAddr .IP .IsUnspecified () {
285+ ds = append (ds , ourAddr )
286+ }
287+ return ds
288+ }
You can’t perform that action at this time.
0 commit comments