Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-swarm
Commits
13f9cc92
Commit
13f9cc92
authored
Aug 11, 2021
by
tavit ohanian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial port
parent
ad377594
Pipeline
#844
passed with stages
in 3 minutes and 25 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
7 additions
and
7 deletions
+7
-7
limiter.go
limiter.go
+1
-1
swarm.go
swarm.go
+1
-1
swarm_dial.go
swarm_dial.go
+1
-1
swarm_net_test.go
swarm_net_test.go
+1
-1
swarm_stream.go
swarm_stream.go
+1
-1
swarm_test.go
swarm_test.go
+1
-1
swarm_transport.go
swarm_transport.go
+1
-1
No files found.
limiter.go
View file @
13f9cc92
...
...
@@ -59,7 +59,7 @@ type isFdConsumingFnc func(ma.Multiaddr) bool
func
newDialLimiter
(
df
dialfunc
,
fdFnc
isFdConsumingFnc
)
*
dialLimiter
{
fd
:=
ConcurrentFdDials
if
env
:=
os
.
Getenv
(
"
LIB
P2P_SWARM_FD_LIMIT"
);
env
!=
""
{
if
env
:=
os
.
Getenv
(
"P2P_SWARM_FD_LIMIT"
);
env
!=
""
{
if
n
,
err
:=
strconv
.
ParseInt
(
env
,
10
,
32
);
err
==
nil
{
fd
=
int
(
n
)
}
...
...
swarm.go
View file @
13f9cc92
...
...
@@ -99,7 +99,7 @@ type Swarm struct {
// NewSwarm constructs a Swarm.
//
// NOTE: go-
lib
p2p will be moving to dependency injection soon. The variadic
// NOTE: go-p2p will be moving to dependency injection soon. The variadic
// `extra` interface{} parameter facilitates the future migration. Supported
// elements are:
// - connmgr.ConnectionGater
...
...
swarm_dial.go
View file @
13f9cc92
...
...
@@ -719,7 +719,7 @@ func (s *Swarm) dialAddr(ctx context.Context, p peer.ID, addr ma.Multiaddr) (tra
return
connC
,
nil
}
// TODO We should have a `IsFdConsuming() bool` method on the `Transport` interface in go-
lib
p2p-core/transport.
// TODO We should have a `IsFdConsuming() bool` method on the `Transport` interface in go-p2p-core/transport.
// This function checks if any of the transport protocols in the address requires a file descriptor.
// For now:
// A Non-circuit address which has the TCP/UNIX protocol is deemed FD consuming.
...
...
swarm_net_test.go
View file @
13f9cc92
...
...
@@ -109,7 +109,7 @@ func TestNetworkOpenStream(t *testing.T) {
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
testString
:=
"hello
ipfs
"
testString
:=
"hello
dms3
"
nets
:=
make
([]
network
.
Network
,
4
)
for
i
:=
0
;
i
<
4
;
i
++
{
...
...
swarm_stream.go
View file @
13f9cc92
...
...
@@ -11,7 +11,7 @@ import (
"gitlab.dms3.io/p2p/go-p2p-core/protocol"
)
// Validate Stream conforms to the go-
lib
p2p-net Stream interface
// Validate Stream conforms to the go-p2p-net Stream interface
var
_
network
.
Stream
=
&
Stream
{}
// Stream is the stream type used by swarm. In general, you won't use this type
...
...
swarm_test.go
View file @
13f9cc92
...
...
@@ -31,7 +31,7 @@ func EchoStreamHandler(stream network.Stream) {
go
func
()
{
defer
stream
.
Close
()
// pull out the
ipfs
conn
// pull out the
dms3
conn
c
:=
stream
.
Conn
()
log
.
Infof
(
"%s ponging to %s"
,
c
.
LocalPeer
(),
c
.
RemotePeer
())
...
...
swarm_transport.go
View file @
13f9cc92
...
...
@@ -73,7 +73,7 @@ func (s *Swarm) TransportForListening(a ma.Multiaddr) transport.Transport {
// AddTransport adds a transport to this swarm.
//
// Satisfies the Network interface from go-
lib
p2p-transport.
// Satisfies the Network interface from go-p2p-transport.
func
(
s
*
Swarm
)
AddTransport
(
t
transport
.
Transport
)
error
{
protocols
:=
t
.
Protocols
()
...
...
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