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-tcp-transport
Commits
5a21aa94
Commit
5a21aa94
authored
Apr 09, 2017
by
Marten Seemann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
be explicit about the interfaces implemented
parent
9e9c6d16
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
tcp.go
tcp.go
+6
-0
No files found.
tcp.go
View file @
5a21aa94
...
@@ -25,6 +25,8 @@ type TcpTransport struct {
...
@@ -25,6 +25,8 @@ type TcpTransport struct {
listeners
map
[
string
]
tpt
.
Listener
listeners
map
[
string
]
tpt
.
Listener
}
}
var
_
tpt
.
Transport
=
&
TcpTransport
{}
// NewTCPTransport creates a tcp transport object that tracks dialers and listeners
// NewTCPTransport creates a tcp transport object that tracks dialers and listeners
// created. It represents an entire tcp stack (though it might not necessarily be)
// created. It represents an entire tcp stack (though it might not necessarily be)
func
NewTCPTransport
()
*
TcpTransport
{
func
NewTCPTransport
()
*
TcpTransport
{
...
@@ -135,6 +137,8 @@ type tcpDialer struct {
...
@@ -135,6 +137,8 @@ type tcpDialer struct {
transport
tpt
.
Transport
transport
tpt
.
Transport
}
}
var
_
tpt
.
Dialer
=
&
tcpDialer
{}
func
(
t
*
TcpTransport
)
newTcpDialer
(
base
manet
.
Dialer
,
laddr
ma
.
Multiaddr
,
doReuse
bool
)
(
*
tcpDialer
,
error
)
{
func
(
t
*
TcpTransport
)
newTcpDialer
(
base
manet
.
Dialer
,
laddr
ma
.
Multiaddr
,
doReuse
bool
)
(
*
tcpDialer
,
error
)
{
// get the local net.Addr manually
// get the local net.Addr manually
la
,
err
:=
manet
.
ToNetAddr
(
laddr
)
la
,
err
:=
manet
.
ToNetAddr
(
laddr
)
...
@@ -238,6 +242,8 @@ type tcpListener struct {
...
@@ -238,6 +242,8 @@ type tcpListener struct {
transport
tpt
.
Transport
transport
tpt
.
Transport
}
}
var
_
tpt
.
Listener
=
&
tcpListener
{}
func
(
d
*
tcpListener
)
Accept
()
(
tpt
.
Conn
,
error
)
{
func
(
d
*
tcpListener
)
Accept
()
(
tpt
.
Conn
,
error
)
{
c
,
err
:=
d
.
list
.
Accept
()
c
,
err
:=
d
.
list
.
Accept
()
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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