Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
b6aff366
Commit
b6aff366
authored
Oct 03, 2016
by
Jeromy Johnson
Committed by
GitHub
Oct 03, 2016
Browse files
Merge pull request #126 from libp2p/feat/use-stdlib-ctx
switch to using stdlib context package
parents
87b0e200
4dd30d82
Changes
40
Hide whitespace changes
Inline
Side-by-side
p2p/net/swarm/dial_test.go
View file @
b6aff366
...
@@ -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
)
{
...
...
p2p/net/swarm/peers_test.go
View file @
b6aff366
...
@@ -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
)
{
...
...
p2p/net/swarm/simul_test.go
View file @
b6aff366
...
@@ -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
)
{
...
...
p2p/net/swarm/swarm_addr_test.go
View file @
b6aff366
...
@@ -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
)
{
...
...
p2p/net/swarm/swarm_conn.go
View file @
b6aff366
...
@@ -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
...
...
p2p/net/swarm/swarm_listen.go
View file @
b6aff366
...
@@ -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
{
...
...
p2p/net/swarm/swarm_net.go
View file @
b6aff366
...
@@ -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.
...
...
p2p/net/swarm/swarm_net_test.go
View file @
b6aff366
...
@@ -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
...
...
p2p/net/swarm/swarm_notif_test.go
View file @
b6aff366
...
@@ -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
{
...
...
p2p/net/swarm/swarm_test.go
View file @
b6aff366
...
@@ -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
)
{
...
...
p2p/protocol/identify/id.go
View file @
b6aff366
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"
...
...
p2p/protocol/identify/id_test.go
View file @
b6aff366
...
@@ -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
)
{
...
...
p2p/protocol/ping/ping.go
View file @
b6aff366
...
@@ -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"
)
...
...
p2p/protocol/ping/ping_test.go
View file @
b6aff366
...
@@ -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
)
{
...
...
p2p/protocol/relay/relay.go
View file @
b6aff366
...
@@ -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"
)
...
...
p2p/protocol/relay/relay_test.go
View file @
b6aff366
...
@@ -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"
)
...
...
p2p/test/backpressure/backpressure_test.go
View file @
b6aff366
...
@@ -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"
)
...
...
p2p/test/reconnects/reconnect_test.go
View file @
b6aff366
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
()
{
...
...
p2p/test/util/util.go
View file @
b6aff366
...
@@ -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
{
...
...
package.json
View file @
b6aff366
...
@@ -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"
,
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment