Commit b6aff366 authored by Jeromy Johnson's avatar Jeromy Johnson Committed by GitHub
Browse files

Merge pull request #126 from libp2p/feat/use-stdlib-ctx

switch to using stdlib context package
parents 87b0e200 4dd30d82
...@@ -10,11 +10,11 @@ import ( ...@@ -10,11 +10,11 @@ import (
testutil "github.com/libp2p/go-libp2p/testutil" testutil "github.com/libp2p/go-libp2p/testutil"
ci "github.com/libp2p/go-libp2p/testutil/ci" ci "github.com/libp2p/go-libp2p/testutil/ci"
"context"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
pstore "github.com/ipfs/go-libp2p-peerstore" pstore "github.com/ipfs/go-libp2p-peerstore"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
manet "github.com/jbenet/go-multiaddr-net" manet "github.com/jbenet/go-multiaddr-net"
context "golang.org/x/net/context"
) )
func closeSwarms(swarms []*Swarm) { func closeSwarms(swarms []*Swarm) {
......
...@@ -3,10 +3,10 @@ package swarm ...@@ -3,10 +3,10 @@ package swarm
import ( import (
"testing" "testing"
"context"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
pstore "github.com/ipfs/go-libp2p-peerstore" pstore "github.com/ipfs/go-libp2p-peerstore"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
context "golang.org/x/net/context"
) )
func TestPeers(t *testing.T) { func TestPeers(t *testing.T) {
......
...@@ -8,10 +8,10 @@ import ( ...@@ -8,10 +8,10 @@ import (
ci "github.com/libp2p/go-libp2p/testutil/ci" ci "github.com/libp2p/go-libp2p/testutil/ci"
"context"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
pstore "github.com/ipfs/go-libp2p-peerstore" pstore "github.com/ipfs/go-libp2p-peerstore"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
context "golang.org/x/net/context"
) )
func TestSimultOpen(t *testing.T) { func TestSimultOpen(t *testing.T) {
......
...@@ -7,9 +7,9 @@ import ( ...@@ -7,9 +7,9 @@ import (
addrutil "github.com/libp2p/go-libp2p/p2p/net/swarm/addr" addrutil "github.com/libp2p/go-libp2p/p2p/net/swarm/addr"
testutil "github.com/libp2p/go-libp2p/testutil" testutil "github.com/libp2p/go-libp2p/testutil"
"context"
pstore "github.com/ipfs/go-libp2p-peerstore" pstore "github.com/ipfs/go-libp2p-peerstore"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
context "golang.org/x/net/context"
) )
func TestFilterAddrs(t *testing.T) { func TestFilterAddrs(t *testing.T) {
......
...@@ -6,11 +6,11 @@ import ( ...@@ -6,11 +6,11 @@ import (
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
conn "github.com/libp2p/go-libp2p/p2p/net/conn" conn "github.com/libp2p/go-libp2p/p2p/net/conn"
"context"
ic "github.com/ipfs/go-libp2p-crypto" ic "github.com/ipfs/go-libp2p-crypto"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
ps "github.com/jbenet/go-peerstream" ps "github.com/jbenet/go-peerstream"
context "golang.org/x/net/context"
) )
// Conn is a simple wrapper around a ps.Conn that also exposes // Conn is a simple wrapper around a ps.Conn that also exposes
......
...@@ -3,6 +3,7 @@ package swarm ...@@ -3,6 +3,7 @@ package swarm
import ( import (
"fmt" "fmt"
"context"
lgbl "github.com/ipfs/go-libp2p-loggables" lgbl "github.com/ipfs/go-libp2p-loggables"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
ps "github.com/jbenet/go-peerstream" ps "github.com/jbenet/go-peerstream"
...@@ -10,7 +11,6 @@ import ( ...@@ -10,7 +11,6 @@ import (
mconn "github.com/libp2p/go-libp2p/p2p/metrics/conn" mconn "github.com/libp2p/go-libp2p/p2p/metrics/conn"
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
conn "github.com/libp2p/go-libp2p/p2p/net/conn" conn "github.com/libp2p/go-libp2p/p2p/net/conn"
context "golang.org/x/net/context"
) )
func (s *Swarm) AddListenAddr(a ma.Multiaddr) error { func (s *Swarm) AddListenAddr(a ma.Multiaddr) error {
......
...@@ -8,9 +8,9 @@ import ( ...@@ -8,9 +8,9 @@ import (
metrics "github.com/libp2p/go-libp2p/p2p/metrics" metrics "github.com/libp2p/go-libp2p/p2p/metrics"
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
"context"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
"github.com/jbenet/goprocess" "github.com/jbenet/goprocess"
context "golang.org/x/net/context"
) )
// Network implements the inet.Network interface. // Network implements the inet.Network interface.
......
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
testutil "github.com/libp2p/go-libp2p/p2p/test/util" testutil "github.com/libp2p/go-libp2p/p2p/test/util"
context "golang.org/x/net/context" "context"
) )
// TestConnectednessCorrect starts a few networks, connects a few // TestConnectednessCorrect starts a few networks, connects a few
......
...@@ -4,10 +4,10 @@ import ( ...@@ -4,10 +4,10 @@ import (
"testing" "testing"
"time" "time"
"context"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
context "golang.org/x/net/context"
) )
func streamsSame(a, b inet.Stream) bool { func streamsSame(a, b inet.Stream) bool {
......
...@@ -13,10 +13,10 @@ import ( ...@@ -13,10 +13,10 @@ import (
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
testutil "github.com/libp2p/go-libp2p/testutil" testutil "github.com/libp2p/go-libp2p/testutil"
"context"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
pstore "github.com/ipfs/go-libp2p-peerstore" pstore "github.com/ipfs/go-libp2p-peerstore"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
context "golang.org/x/net/context"
) )
func EchoStreamHandler(stream inet.Stream) { func EchoStreamHandler(stream inet.Stream) {
......
package identify package identify
import ( import (
"context"
"strings" "strings"
"sync" "sync"
...@@ -15,7 +16,6 @@ import ( ...@@ -15,7 +16,6 @@ import (
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
pb "github.com/libp2p/go-libp2p/p2p/protocol/identify/pb" pb "github.com/libp2p/go-libp2p/p2p/protocol/identify/pb"
msmux "github.com/whyrusleeping/go-multistream" msmux "github.com/whyrusleeping/go-multistream"
context "golang.org/x/net/context"
lgbl "github.com/ipfs/go-libp2p-loggables" lgbl "github.com/ipfs/go-libp2p-loggables"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
......
...@@ -10,8 +10,8 @@ import ( ...@@ -10,8 +10,8 @@ import (
identify "github.com/libp2p/go-libp2p/p2p/protocol/identify" identify "github.com/libp2p/go-libp2p/p2p/protocol/identify"
testutil "github.com/libp2p/go-libp2p/p2p/test/util" testutil "github.com/libp2p/go-libp2p/p2p/test/util"
"context"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
context "golang.org/x/net/context"
) )
func subtestIDService(t *testing.T, postDialWait time.Duration) { func subtestIDService(t *testing.T, postDialWait time.Duration) {
......
...@@ -2,6 +2,7 @@ package ping ...@@ -2,6 +2,7 @@ package ping
import ( import (
"bytes" "bytes"
"context"
"errors" "errors"
"io" "io"
"time" "time"
...@@ -11,7 +12,6 @@ import ( ...@@ -11,7 +12,6 @@ import (
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
host "github.com/libp2p/go-libp2p/p2p/host" host "github.com/libp2p/go-libp2p/p2p/host"
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
context "golang.org/x/net/context"
) )
var log = logging.Logger("ping") var log = logging.Logger("ping")
......
...@@ -6,9 +6,9 @@ import ( ...@@ -6,9 +6,9 @@ import (
netutil "github.com/libp2p/go-libp2p/p2p/test/util" netutil "github.com/libp2p/go-libp2p/p2p/test/util"
"context"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
pstore "github.com/ipfs/go-libp2p-peerstore" pstore "github.com/ipfs/go-libp2p-peerstore"
context "golang.org/x/net/context"
) )
func TestPing(t *testing.T) { func TestPing(t *testing.T) {
......
...@@ -5,13 +5,13 @@ import ( ...@@ -5,13 +5,13 @@ import (
"io" "io"
"time" "time"
"context"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
mh "github.com/jbenet/go-multihash" mh "github.com/jbenet/go-multihash"
host "github.com/libp2p/go-libp2p/p2p/host" host "github.com/libp2p/go-libp2p/p2p/host"
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
protocol "github.com/libp2p/go-libp2p/p2p/protocol" protocol "github.com/libp2p/go-libp2p/p2p/protocol"
context "golang.org/x/net/context"
) )
var log = logging.Logger("github.com/libp2p/go-libp2p/p2p/protocol/relay") var log = logging.Logger("github.com/libp2p/go-libp2p/p2p/protocol/relay")
......
...@@ -4,13 +4,13 @@ import ( ...@@ -4,13 +4,13 @@ import (
"io" "io"
"testing" "testing"
"context"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
protocol "github.com/libp2p/go-libp2p/p2p/protocol" protocol "github.com/libp2p/go-libp2p/p2p/protocol"
relay "github.com/libp2p/go-libp2p/p2p/protocol/relay" relay "github.com/libp2p/go-libp2p/p2p/protocol/relay"
testutil "github.com/libp2p/go-libp2p/p2p/test/util" testutil "github.com/libp2p/go-libp2p/p2p/test/util"
msmux "github.com/whyrusleeping/go-multistream" msmux "github.com/whyrusleeping/go-multistream"
context "golang.org/x/net/context"
) )
var log = logging.Logger("relay_test") var log = logging.Logger("relay_test")
......
...@@ -6,6 +6,7 @@ import ( ...@@ -6,6 +6,7 @@ import (
"testing" "testing"
"time" "time"
"context"
u "github.com/ipfs/go-ipfs-util" u "github.com/ipfs/go-ipfs-util"
peer "github.com/ipfs/go-libp2p-peer" peer "github.com/ipfs/go-libp2p-peer"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
...@@ -13,7 +14,6 @@ import ( ...@@ -13,7 +14,6 @@ import (
inet "github.com/libp2p/go-libp2p/p2p/net" inet "github.com/libp2p/go-libp2p/p2p/net"
protocol "github.com/libp2p/go-libp2p/p2p/protocol" protocol "github.com/libp2p/go-libp2p/p2p/protocol"
testutil "github.com/libp2p/go-libp2p/p2p/test/util" testutil "github.com/libp2p/go-libp2p/p2p/test/util"
context "golang.org/x/net/context"
) )
var log = logging.Logger("backpressure") var log = logging.Logger("backpressure")
......
package reconnect package reconnect
import ( import (
"context"
"io" "io"
"math/rand" "math/rand"
"sync" "sync"
...@@ -15,7 +16,6 @@ import ( ...@@ -15,7 +16,6 @@ import (
swarm "github.com/libp2p/go-libp2p/p2p/net/swarm" swarm "github.com/libp2p/go-libp2p/p2p/net/swarm"
protocol "github.com/libp2p/go-libp2p/p2p/protocol" protocol "github.com/libp2p/go-libp2p/p2p/protocol"
testutil "github.com/libp2p/go-libp2p/p2p/test/util" testutil "github.com/libp2p/go-libp2p/p2p/test/util"
context "golang.org/x/net/context"
) )
func init() { func init() {
......
...@@ -10,8 +10,8 @@ import ( ...@@ -10,8 +10,8 @@ import (
swarm "github.com/libp2p/go-libp2p/p2p/net/swarm" swarm "github.com/libp2p/go-libp2p/p2p/net/swarm"
tu "github.com/libp2p/go-libp2p/testutil" tu "github.com/libp2p/go-libp2p/testutil"
"context"
ma "github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-multiaddr"
context "golang.org/x/net/context"
) )
func GenSwarmNetwork(t *testing.T, ctx context.Context) *swarm.Network { func GenSwarmNetwork(t *testing.T, ctx context.Context) *swarm.Network {
......
...@@ -103,11 +103,6 @@ ...@@ -103,11 +103,6 @@
"name": "randbo", "name": "randbo",
"version": "0.0.0" "version": "0.0.0"
}, },
{
"hash": "QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt",
"name": "go-net",
"version": "0.0.0"
},
{ {
"hash": "Qmb1US8uyZeEpMyc56wVZy2cDFdQjNFojAUYVCoo9ieTqp", "hash": "Qmb1US8uyZeEpMyc56wVZy2cDFdQjNFojAUYVCoo9ieTqp",
"name": "go-stream-muxer", "name": "go-stream-muxer",
......
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