Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
db33a386
Commit
db33a386
authored
May 15, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8785e160
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
go/xcommon/xnet/lonet/lonet.go
go/xcommon/xnet/lonet/lonet.go
+11
-7
No files found.
go/xcommon/xnet/lonet/lonet.go
View file @
db33a386
...
...
@@ -105,7 +105,7 @@ package lonet
import
(
"context"
"errors"
stderrors
"errors"
"fmt"
"io"
"io/ioutil"
...
...
@@ -116,6 +116,8 @@ import (
"strconv"
"sync"
"github.com/pkg/errors"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xnet"
)
...
...
@@ -123,10 +125,10 @@ import (
const
NetPrefix
=
"lonet"
// lonet package creates only "lonet*" networks
var
(
// errNetClosed = errors.New("network connection closed")
// errAddrAlreadyUsed = errors.New("address already in use")
// errAddrNoListen = errors.New("cannot listen on requested address")
errConnRefused
=
errors
.
New
(
"connection refused"
)
// errNetClosed =
std
errors.New("network connection closed")
// errAddrAlreadyUsed =
std
errors.New("address already in use")
// errAddrNoListen =
std
errors.New("cannot listen on requested address")
errConnRefused
=
std
errors
.
New
(
"connection refused"
)
)
// Addr represents address of a lonet endpoint.
...
...
@@ -324,7 +326,7 @@ func (n *SubNetwork) serve() { // XXX error?
go
func
()
{
err
:=
n
.
loaccept
(
osconn
)
// XXX + ctx?
if
err
!=
nil
{
if
err
!=
nil
&&
errors
.
Cause
(
err
)
!=
errConnRefused
{
log
.
Print
(
err
)
// XXX ok?
}
}()
...
...
@@ -345,7 +347,7 @@ func (n *SubNetwork) loaccept(osconn net.Conn) (err error) {
}
}()
defer
xerr
.
Contextf
(
&
err
,
"lonet %q:
handshake
"
,
n
.
network
)
defer
xerr
.
Contextf
(
&
err
,
"lonet %q:
accept
"
,
n
.
network
)
// read handshake line and parse it
line
,
err
:=
readline
(
osconn
,
1024
)
// limit line length not to cause memory dos
...
...
@@ -396,6 +398,8 @@ func (n *SubNetwork) loaccept(osconn net.Conn) (err error) {
return
ereplyf
(
"dst address invalid"
)
}
defer
xerr
.
Contextf
(
&
err
,
"%s -> %s"
,
src
,
dst
)
// check dst host:port in .hostMap
n
.
mu
.
Lock
()
host
:=
n
.
hostMap
[
adst
.
Host
]
...
...
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