Merge pull request #73 from libp2p/feat/refactor

update for transport refactor
This commit is contained in:
Steven Allen 2018-06-06 07:26:37 +00:00 committed by GitHub
commit 0070dfbf72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 22 deletions

View File

@ -1 +1 @@
0.9.13: QmRMgHdiLHJvySrXbtLBehr1W1yTQyuNmZG8HghG54ZPDz 0.9.14: QmaWsab8a1KQgoxWP3RjK7mBhSi5PB9pR6NwZUrSXvVd1i

View File

@ -70,7 +70,7 @@ func (p *PubSub) handleSendingMessages(ctx context.Context, s inet.Stream, outgo
return bufw.Flush() return bufw.Flush()
} }
defer s.Close() defer inet.FullClose(s)
for { for {
select { select {
case rpc, ok := <-outgoing: case rpc, ok := <-outgoing:

View File

@ -11,8 +11,8 @@ import (
"time" "time"
host "github.com/libp2p/go-libp2p-host" host "github.com/libp2p/go-libp2p-host"
netutil "github.com/libp2p/go-libp2p-netutil"
peer "github.com/libp2p/go-libp2p-peer" peer "github.com/libp2p/go-libp2p-peer"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
//bhost "github.com/libp2p/go-libp2p/p2p/host/basic" //bhost "github.com/libp2p/go-libp2p/p2p/host/basic"
bhost "github.com/libp2p/go-libp2p-blankhost" bhost "github.com/libp2p/go-libp2p-blankhost"
) )
@ -37,7 +37,7 @@ func getNetHosts(t *testing.T, ctx context.Context, n int) []host.Host {
var out []host.Host var out []host.Host
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
netw := netutil.GenSwarmNetwork(t, ctx) netw := swarmt.GenSwarm(t, ctx)
h := bhost.NewBlankHost(netw) h := bhost.NewBlankHost(netw)
out = append(out, h) out = append(out, h)
} }
@ -777,11 +777,7 @@ func TestPeerDisconnect(t *testing.T) {
peers := psubs[0].ListPeers("foo") peers := psubs[0].ListPeers("foo")
assertPeerList(t, peers, hosts[1].ID()) assertPeerList(t, peers, hosts[1].ID())
for _, c := range hosts[1].Network().ConnsToPeer(hosts[0].ID()) { for _, c := range hosts[1].Network().ConnsToPeer(hosts[0].ID()) {
streams, err := c.GetStreams() for _, s := range c.GetStreams() {
if err != nil {
t.Fatal(err)
}
for _, s := range streams {
s.Close() s.Close()
} }
} }

View File

@ -21,27 +21,21 @@
}, },
{ {
"author": "whyrusleeping", "author": "whyrusleeping",
"hash": "QmaSfSMvc1VPZ8JbMponFs4WHvF9FgEruF56opm5E1RgQA", "hash": "QmdHyfNVTZ5VtUx4Xz23z8wtnioSrFQ28XSfpVkdhQBkGA",
"name": "go-libp2p-host", "name": "go-libp2p-host",
"version": "2.1.8" "version": "3.0.0"
}, },
{ {
"author": "whyrusleeping", "author": "whyrusleeping",
"hash": "Qma2UuHusnaFV24DgeZ5hyrM9uc4UdyVaZbtn2FQsPRhES", "hash": "QmQ6ASb73YCy77TLfxzKnzQFUyFKMQzDhmjwjaQp6rxK34",
"name": "go-libp2p-netutil",
"version": "0.3.13"
},
{
"author": "whyrusleeping",
"hash": "QmYEmPwCBe7ZUFfuymozopHTuF3JXejvJPDAjwtyQCrsDi",
"name": "go-libp2p-blankhost", "name": "go-libp2p-blankhost",
"version": "0.2.8" "version": "0.3.0"
}, },
{ {
"author": "whyrusleeping", "author": "whyrusleeping",
"hash": "QmXoz9o2PT3tEzf7hicegwex5UgVP54n3k82K7jrWFyN86", "hash": "QmYj8wdn5sZEHX2XMDWGBvcXJNdzVbaVpHmXvhHBVZepen",
"name": "go-libp2p-net", "name": "go-libp2p-net",
"version": "2.0.7" "version": "3.0.0"
}, },
{ {
"hash": "QmTG23dvpBCBjqQwyDxV8CQT6jmS4PSftNr1VqHhE3MLy7", "hash": "QmTG23dvpBCBjqQwyDxV8CQT6jmS4PSftNr1VqHhE3MLy7",
@ -65,6 +59,12 @@
"hash": "QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN", "hash": "QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN",
"name": "go-libp2p-protocol", "name": "go-libp2p-protocol",
"version": "1.0.0" "version": "1.0.0"
},
{
"author": "whyrusleeping",
"hash": "QmPzT3rJnSP8VFP1kw7Ly7HP8AprKNZtwLHXHnxfVSbWT3",
"name": "go-libp2p-swarm",
"version": "3.0.0"
} }
], ],
"gxVersion": "0.9.0", "gxVersion": "0.9.0",
@ -72,6 +72,6 @@
"license": "", "license": "",
"name": "go-libp2p-floodsub", "name": "go-libp2p-floodsub",
"releaseCmd": "git commit -a -m \"gx publish $VERSION\"", "releaseCmd": "git commit -a -m \"gx publish $VERSION\"",
"version": "0.9.13" "version": "0.9.14"
} }