Commit cb8a96a1 authored by Brian Tiger Chow's avatar Brian Tiger Chow Committed by Juan Batiz-Benet

style(bitswap) public methods at top

parent e42045ad
......@@ -30,29 +30,6 @@ type impl struct {
receiver Receiver
}
// handleNewStream receives a new stream from the network.
func (bsnet *impl) handleNewStream(s inet.Stream) {
if bsnet.receiver == nil {
return
}
go func() {
defer s.Close()
received, err := bsmsg.FromNet(s)
if err != nil {
go bsnet.receiver.ReceiveError(err)
return
}
p := s.Conn().RemotePeer()
ctx := context.Background()
bsnet.receiver.ReceiveMessage(ctx, p, received)
}()
}
func (bsnet *impl) DialPeer(ctx context.Context, p peer.ID) error {
return bsnet.network.DialPeer(ctx, p)
}
......@@ -92,3 +69,26 @@ func (bsnet *impl) SendRequest(
func (bsnet *impl) SetDelegate(r Receiver) {
bsnet.receiver = r
}
// handleNewStream receives a new stream from the network.
func (bsnet *impl) handleNewStream(s inet.Stream) {
if bsnet.receiver == nil {
return
}
go func() {
defer s.Close()
received, err := bsmsg.FromNet(s)
if err != nil {
go bsnet.receiver.ReceiveError(err)
return
}
p := s.Conn().RemotePeer()
ctx := context.Background()
bsnet.receiver.ReceiveMessage(ctx, p, received)
}()
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment