1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 05:52:20 +08:00

refactor(bitswap) bitswap.Network now abstracts ipfs.Network + ipfs.Routing

@jbenet @whyrusleeping

the next commit will change bitswap.Network.FindProviders to only deal
with IDs
This commit is contained in:
Brian Tiger Chow
2014-12-23 08:16:05 -05:00
committed by Juan Batiz-Benet
parent c6294646e9
commit 27dc9594ba
10 changed files with 71 additions and 55 deletions

View File

@ -11,10 +11,11 @@ import (
bsnet "github.com/jbenet/go-ipfs/exchange/bitswap/network"
peer "github.com/jbenet/go-ipfs/peer"
delay "github.com/jbenet/go-ipfs/util/delay"
mockrouting "github.com/jbenet/go-ipfs/routing/mock"
)
func TestSendRequestToCooperativePeer(t *testing.T) {
net := VirtualNetwork(delay.Fixed(0))
net := VirtualNetwork(mockrouting.NewServer(),delay.Fixed(0))
idOfRecipient := peer.ID("recipient")
@ -65,7 +66,7 @@ func TestSendRequestToCooperativePeer(t *testing.T) {
}
func TestSendMessageAsyncButWaitForResponse(t *testing.T) {
net := VirtualNetwork(delay.Fixed(0))
net := VirtualNetwork(mockrouting.NewServer(), delay.Fixed(0))
idOfResponder := peer.ID("responder")
waiter := net.Adapter(peer.ID("waiter"))
responder := net.Adapter(idOfResponder)