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
2
Merge Requests
2
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
9c3998b9
Commit
9c3998b9
authored
Jul 17, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a62c9889
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
8 deletions
+15
-8
go/neo/server/master.go
go/neo/server/master.go
+12
-5
go/neo/server/server.go
go/neo/server/server.go
+1
-1
go/xcommon/xnet/net.go
go/xcommon/xnet/net.go
+2
-2
No files found.
go/neo/server/master.go
View file @
9c3998b9
...
...
@@ -71,19 +71,19 @@ type Master struct {
}
// node connects
//
event:
node connects
type
nodeCome
struct
{
link
*
neo
.
NodeLink
idReq
neo
.
RequestIdentification
// we received this identification request
idResp
chan
neo
.
Msg
// what we reply (AcceptIdentification | Error)
}
// node disconnects
//
event:
node disconnects
type
nodeLeave
struct
{
link
*
neo
.
NodeLink
// XXX better use uuid allocated on nodeCome
?
link
*
neo
.
NodeLink
// XXX better use uuid allocated on nodeCome
}
// NewMaster creates new master node that will listen on serveAddr
// NewMaster creates new master node that will listen on serveAddr
.
// Use Run to actually start running the node.
func
NewMaster
(
clusterName
,
serveAddr
string
,
net
xnet
.
Networker
)
*
Master
{
// convert serveAddr into neo format
...
...
@@ -97,6 +97,13 @@ func NewMaster(clusterName, serveAddr string, net xnet.Networker) *Master {
clusterName
:
clusterName
,
net
:
net
,
masterAddr
:
serveAddr
,
// XXX ok?
ctlStart
:
make
(
chan
chan
error
),
ctlStop
:
make
(
chan
chan
error
),
ctlShutdown
:
make
(
chan
chan
error
),
nodeCome
:
make
(
chan
nodeCome
),
nodeLeave
:
make
(
chan
nodeLeave
),
}
m
.
myInfo
.
NodeUUID
=
m
.
allocUUID
(
neo
.
MASTER
)
...
...
@@ -718,7 +725,7 @@ func (m *Master) allocUUID(nodeType neo.NodeType) neo.NodeUUID {
// XXX +error return?
func
(
m
*
Master
)
ServeLink
(
ctx
context
.
Context
,
link
*
neo
.
NodeLink
)
{
logf
:=
func
(
format
string
,
argv
...
interface
{})
{
fmt
.
Printf
(
"master: %s: "
+
format
+
"
\n
"
,
append
([]
interface
{}{
link
},
argv
...
))
fmt
.
Printf
(
"master: %s: "
+
format
+
"
\n
"
,
append
([]
interface
{}{
link
},
argv
...
)
...
)
}
logf
(
"serving new node"
)
...
...
go/neo/server/server.go
View file @
9c3998b9
...
...
@@ -39,7 +39,7 @@ type Server interface {
// Serve runs service on a listener
// - accept incoming connection on the listener
// - for every accepted connection spawn srv.ServeLink() in separate goroutine.
// - for every accepted connection spawn
handshake +
srv.ServeLink() in separate goroutine.
//
// the listener is closed when Serve returns.
func
Serve
(
ctx
context
.
Context
,
l
net
.
Listener
,
srv
Server
)
error
{
...
...
go/xcommon/xnet/net.go
View file @
9c3998b9
...
...
@@ -46,7 +46,7 @@ type Networker interface {
}
// NetPlain creates Networker corresponding to regular network accessors from std package net
// NetPlain creates Networker corresponding to regular network accessors from std package net
.
// network is "tcp", "tcp4", "tcp6", "unix", etc...
func
NetPlain
(
network
string
)
Networker
{
return
netPlain
(
network
)
...
...
@@ -67,7 +67,7 @@ func (n netPlain) Listen(laddr string) (net.Listener, error) {
return
net
.
Listen
(
string
(
n
),
laddr
)
}
// NetTLS wraps underlying networker with TLS layer according to config
// NetTLS wraps underlying networker with TLS layer according to config
.
// The config must be valid:
// - for tls.Client -- for Dial to work,
// - for tls.Server -- for Listen to work.
...
...
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