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
package main
import (
"context"
"flag"
"fmt"
"io/ioutil"
......@@ -17,7 +18,6 @@ import (
testutil "github.com/libp2p/go-libp2p/testutil"
ma "github.com/jbenet/go-multiaddr"
context "golang.org/x/net/context"
)
// create a 'Host' with a random peer to listen on the given address
......
package basichost
import (
"context"
"io"
"time"
......@@ -15,7 +16,6 @@ import (
protocol "github.com/libp2p/go-libp2p/p2p/protocol"
identify "github.com/libp2p/go-libp2p/p2p/protocol/identify"
relay "github.com/libp2p/go-libp2p/p2p/protocol/relay"
context "golang.org/x/net/context"
msmux "github.com/whyrusleeping/go-multistream"
)
......
......@@ -2,6 +2,7 @@ package basichost_test
import (
"bytes"
"context"
"io"
"testing"
"time"
......@@ -10,8 +11,6 @@ import (
inet "github.com/libp2p/go-libp2p/p2p/net"
protocol "github.com/libp2p/go-libp2p/p2p/protocol"
testutil "github.com/libp2p/go-libp2p/p2p/test/util"
context "golang.org/x/net/context"
)
func TestHostSimple(t *testing.T) {
......
package basichost
import (
"context"
"sync"
lgbl "github.com/ipfs/go-libp2p-loggables"
......@@ -8,7 +9,6 @@ import (
goprocess "github.com/jbenet/goprocess"
inat "github.com/libp2p/go-libp2p/p2p/nat"
inet "github.com/libp2p/go-libp2p/p2p/net"
context "golang.org/x/net/context"
)
// natManager takes care of adding + removing port mappings to the nat.
......
package host
import (
"context"
peer "github.com/ipfs/go-libp2p-peer"
pstore "github.com/ipfs/go-libp2p-peerstore"
logging "github.com/ipfs/go-log"
......@@ -9,7 +11,6 @@ import (
inet "github.com/libp2p/go-libp2p/p2p/net"
protocol "github.com/libp2p/go-libp2p/p2p/protocol"
msmux "github.com/whyrusleeping/go-multistream"
context "golang.org/x/net/context"
)
var log = logging.Logger("github.com/libp2p/go-libp2p/p2p/host")
......
package routedhost
import (
"context"
"fmt"
"time"
......@@ -13,7 +14,6 @@ import (
metrics "github.com/libp2p/go-libp2p/p2p/metrics"
inet "github.com/libp2p/go-libp2p/p2p/net"
protocol "github.com/libp2p/go-libp2p/p2p/protocol"
context "golang.org/x/net/context"
msmux "github.com/whyrusleeping/go-multistream"
)
......
package conn
import (
"context"
"fmt"
"io"
"net"
......@@ -14,7 +15,6 @@ import (
mpool "github.com/jbenet/go-msgio/mpool"
ma "github.com/jbenet/go-multiaddr"
manet "github.com/jbenet/go-multiaddr-net"
context "golang.org/x/net/context"
)
var log = logging.Logger("conn")
......
......@@ -8,9 +8,9 @@ import (
"testing"
"time"
"context"
msgio "github.com/jbenet/go-msgio"
travis "github.com/libp2p/go-libp2p/testutil/ci/travis"
context "golang.org/x/net/context"
)
func msgioWrap(c Conn) msgio.ReadWriter {
......
......@@ -6,6 +6,7 @@ import (
"strings"
"time"
"context"
ci "github.com/ipfs/go-libp2p-crypto"
lgbl "github.com/ipfs/go-libp2p-loggables"
peer "github.com/ipfs/go-libp2p-peer"
......@@ -14,7 +15,6 @@ import (
transport "github.com/libp2p/go-libp2p-transport"
addrutil "github.com/libp2p/go-libp2p/p2p/net/swarm/addr"
msmux "github.com/whyrusleeping/go-multistream"
context "golang.org/x/net/context"
)
type WrapFunc func(transport.Conn) transport.Conn
......
......@@ -17,10 +17,10 @@ import (
tu "github.com/libp2p/go-libp2p/testutil"
tcpt "github.com/libp2p/go-tcp-transport"
"context"
ma "github.com/jbenet/go-multiaddr"
msmux "github.com/whyrusleeping/go-multistream"
grc "github.com/whyrusleeping/gorocheck"
context "golang.org/x/net/context"
)
func goroFilter(r *grc.Goroutine) bool {
......
package conn
import (
"context"
"fmt"
"io"
"net"
......@@ -16,7 +17,6 @@ import (
transport "github.com/libp2p/go-libp2p-transport"
filter "github.com/libp2p/go-libp2p/p2p/net/filter"
msmux "github.com/whyrusleeping/go-multistream"
context "golang.org/x/net/context"
)
const (
......
package conn
import (
"context"
"errors"
"net"
"time"
......@@ -9,7 +10,6 @@ import (
peer "github.com/ipfs/go-libp2p-peer"
secio "github.com/ipfs/go-libp2p-secio"
ma "github.com/jbenet/go-multiaddr"
context "golang.org/x/net/context"
)
// secureConn wraps another Conn object with an encrypted channel.
......
......@@ -2,6 +2,7 @@ package conn
import (
"bytes"
"context"
"runtime"
"sync"
"testing"
......@@ -9,8 +10,6 @@ import (
ic "github.com/ipfs/go-libp2p-crypto"
travis "github.com/libp2p/go-libp2p/testutil/ci/travis"
context "golang.org/x/net/context"
)
func upgradeToSecureConn(t *testing.T, ctx context.Context, sk ic.PrivKey, c Conn) (Conn, error) {
......
package net
import (
"context"
"io"
peer "github.com/ipfs/go-libp2p-peer"
......@@ -9,7 +10,6 @@ import (
"github.com/jbenet/goprocess"
conn "github.com/libp2p/go-libp2p/p2p/net/conn"
protocol "github.com/libp2p/go-libp2p/p2p/protocol"
context "golang.org/x/net/context"
)
// MessageSizeMax is a soft (recommended) maximum for network messages.
......
package mocknet
import (
"context"
logging "github.com/ipfs/go-log"
context "golang.org/x/net/context"
)
var log = logging.Logger("mocknet")
......
......@@ -11,13 +11,13 @@ import (
p2putil "github.com/libp2p/go-libp2p/p2p/test/util"
testutil "github.com/libp2p/go-libp2p/testutil"
"context"
ic "github.com/ipfs/go-libp2p-crypto"
peer "github.com/ipfs/go-libp2p-peer"
pstore "github.com/ipfs/go-libp2p-peerstore"
ma "github.com/jbenet/go-multiaddr"
"github.com/jbenet/goprocess"
goprocessctx "github.com/jbenet/goprocess/context"
context "golang.org/x/net/context"
)
// mocknet implements mocknet.Mocknet
......
package mocknet
import (
"context"
"testing"
"time"
peer "github.com/ipfs/go-libp2p-peer"
ma "github.com/jbenet/go-multiaddr"
inet "github.com/libp2p/go-libp2p/p2p/net"
context "golang.org/x/net/context"
)
func TestNotifications(t *testing.T) {
......
......@@ -7,12 +7,12 @@ import (
inet "github.com/libp2p/go-libp2p/p2p/net"
"context"
peer "github.com/ipfs/go-libp2p-peer"
pstore "github.com/ipfs/go-libp2p-peerstore"
ma "github.com/jbenet/go-multiaddr"
"github.com/jbenet/goprocess"
goprocessctx "github.com/jbenet/goprocess/context"
context "golang.org/x/net/context"
)
// peernet implements inet.Network
......
......@@ -14,8 +14,8 @@ import (
protocol "github.com/libp2p/go-libp2p/p2p/protocol"
testutil "github.com/libp2p/go-libp2p/testutil"
"context"
detectrace "github.com/jbenet/go-detect-race"
context "golang.org/x/net/context"
)
func randPeer(t *testing.T) peer.ID {
......
......@@ -3,10 +3,10 @@ package addrutil
import (
"fmt"
"context"
logging "github.com/ipfs/go-log"
ma "github.com/jbenet/go-multiaddr"
manet "github.com/jbenet/go-multiaddr-net"
context "golang.org/x/net/context"
_ "github.com/whyrusleeping/ws-transport"
)
......
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