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
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
e0a135a6
Commit
e0a135a6
authored
Jun 05, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X Adapt Dial / ListenAndServe to unified Network
parent
716493af
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
13 deletions
+11
-13
go/neo/client.go
go/neo/client.go
+2
-1
go/neo/connection.go
go/neo/connection.go
+3
-5
go/neo/master.go
go/neo/master.go
+2
-2
go/neo/server.go
go/neo/server.go
+2
-3
go/neo/storage.go
go/neo/storage.go
+2
-2
No files found.
go/neo/client.go
View file @
e0a135a6
...
...
@@ -117,7 +117,8 @@ func NewClient(storLink *NodeLink) (*Client, error) {
func
openClientByURL
(
ctx
context
.
Context
,
u
*
url
.
URL
)
(
zodb
.
IStorage
,
error
)
{
// XXX for now url is treated as storage node URL
// XXX check/use other url fields
storLink
,
err
:=
Dial
(
ctx
,
"tcp"
,
u
.
Host
)
net
:=
NetPlain
(
"tcp"
)
// TODO + TLS; not only "tcp" ?
storLink
,
err
:=
Dial
(
ctx
,
net
,
u
.
Host
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
go/neo/connection.go
View file @
e0a135a6
...
...
@@ -680,11 +680,9 @@ func handshake(ctx context.Context, conn net.Conn, version uint32) (err error) {
// ---- for convenience: Dial ----
// Dial connects to address on named network, handshakes and wraps the connection as NodeLink
// TODO +tls.Config
func
Dial
(
ctx
context
.
Context
,
network
,
address
string
)
(
nl
*
NodeLink
,
err
error
)
{
d
:=
net
.
Dialer
{}
peerConn
,
err
:=
d
.
DialContext
(
ctx
,
network
,
address
)
// Dial connects to address on given network, handshakes and wraps the connection as NodeLink
func
Dial
(
ctx
context
.
Context
,
net
Network
,
addr
string
)
(
nl
*
NodeLink
,
err
error
)
{
peerConn
,
err
:=
net
.
Dial
(
ctx
,
addr
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
go/neo/master.go
View file @
e0a135a6
...
...
@@ -998,8 +998,8 @@ func masterMain(argv []string) {
}()
*/
// TODO + TLS
err
:=
ListenAndServe
(
ctx
,
"tcp"
,
bind
,
masterSrv
)
// XXX "tcp" hardcoded
net
:=
NetPlain
(
"tcp"
)
// TODO + TLS; not only "tcp" ?
err
:=
ListenAndServe
(
ctx
,
net
,
bind
,
masterSrv
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
...
...
go/neo/server.go
View file @
e0a135a6
...
...
@@ -76,9 +76,8 @@ func Serve(ctx context.Context, l net.Listener, srv Server) error {
}
// ListenAndServe listens on network address and then calls Serve to handle incoming connections
// XXX split -> separate Listen() & Serve()
func
ListenAndServe
(
ctx
context
.
Context
,
net_
,
laddr
string
,
srv
Server
)
error
{
l
,
err
:=
net
.
Listen
(
net_
,
laddr
)
func
ListenAndServe
(
ctx
context
.
Context
,
net
Network
,
laddr
string
,
srv
Server
)
error
{
l
,
err
:=
net
.
Listen
(
laddr
)
if
err
!=
nil
{
return
err
}
...
...
go/neo/storage.go
View file @
e0a135a6
...
...
@@ -272,8 +272,8 @@ func storageMain(argv []string) {
}()
*/
// TODO + TLS
err
=
ListenAndServe
(
ctx
,
"tcp"
,
bind
,
storSrv
)
// XXX "tcp" hardcoded
net
:=
NetPlain
(
"tcp"
)
// TODO + TLS; not only "tcp" ?
err
=
ListenAndServe
(
ctx
,
net
,
bind
,
storSrv
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
...
...
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