Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
258372a2
Commit
258372a2
authored
Aug 02, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
71865607
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
go/neo/connection.go
go/neo/connection.go
+11
-5
No files found.
go/neo/connection.go
View file @
258372a2
...
...
@@ -703,7 +703,7 @@ func Listen(net xnet.Networker, laddr string) (*Listener, error) {
}
l
:=
&
Listener
{
Listener
:
rawl
,
l
:
rawl
,
acceptq
:
make
(
chan
accepted
),
closed
:
make
(
chan
struct
{}),
}
...
...
@@ -712,8 +712,10 @@ func Listen(net xnet.Networker, laddr string) (*Listener, error) {
return
l
,
nil
}
// Listener wraps net.Listener to return handshaked NodeLink on Accept.
// Create only via Listen.
type
Listener
struct
{
net
.
Listener
l
net
.
Listener
acceptq
chan
accepted
closed
chan
struct
{}
}
...
...
@@ -724,7 +726,7 @@ type accepted struct {
}
func
(
l
*
Listener
)
Close
()
error
{
err
:=
l
.
Listener
.
Close
()
err
:=
l
.
l
.
Close
()
close
(
l
.
closed
)
return
err
}
...
...
@@ -743,7 +745,7 @@ func (l *Listener) run() {
}
// XXX add backpressure on too much incoming connections without client .Accept
conn
,
err
:=
l
.
Listener
.
Accept
()
conn
,
err
:=
l
.
l
.
Accept
()
go
l
.
accept
(
runCtx
,
conn
,
err
)
}
}
...
...
@@ -774,7 +776,7 @@ func (l *Listener) Accept() (*NodeLink, error) {
select
{
case
<-
l
.
closed
:
// we know raw listener is already closed - return proper error about it
_
,
err
:=
l
.
Listener
.
Accept
()
_
,
err
:=
l
.
l
.
Accept
()
return
nil
,
err
case
a
:=
<-
l
.
acceptq
:
...
...
@@ -782,6 +784,10 @@ func (l *Listener) Accept() (*NodeLink, error) {
}
}
func
(
l
*
Listener
)
Addr
()
net
.
Addr
{
return
l
.
l
.
Addr
()
}
// ---- for convenience: Conn -> NodeLink & local/remote link addresses ----
// LocalAddr returns local address of the underlying link to peer.
...
...
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