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
3a012847
Commit
3a012847
authored
Dec 22, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
2c0b400e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
6 deletions
+57
-6
neo/lib/node.py
neo/lib/node.py
+1
-0
t/NOTES
t/NOTES
+20
-1
t/neo/connection.go
t/neo/connection.go
+35
-4
t/neo/proto.go
t/neo/proto.go
+1
-1
No files found.
neo/lib/node.py
View file @
3a012847
...
...
@@ -450,6 +450,7 @@ class NodeManager(object):
logging
.
info
(
'
\
n
'
.
join
(
formatNodeList
(
map
(
Node
.
asTuple
,
self
.
_node_set
),
' * '
)))
# node_type -> node_klass
@
apply
def
NODE_TYPE_MAPPING
():
def
setmethod
(
cls
,
attr
,
value
):
...
...
t/NOTES
View file @
3a012847
...
...
@@ -588,7 +588,7 @@ HandlerSwitcher
ServerConnection <Connection
KEEP_ALI
C
E = Connection.KEEP_ALIVE + 5
KEEP_ALI
V
E = Connection.KEEP_ALIVE + 5
server = True
# main worker class for handling data exchanging
...
...
@@ -676,3 +676,22 @@ RecoveryManager < MasterHandler
# operational. )
VerificationManager < BaseServiceHandler
...
--------
Node
.state
.address
.uuid
.manager # -> NodeManager
.connection
._identified
NodeManager
[]Node
{} address -> Node
{} uuid -> Node
{} type -> set<Node>
{} state -> set<Node>
t/neo/connection.go
View file @
3a012847
...
...
@@ -15,6 +15,7 @@
package
neo
import
(
"context"
"errors"
"io"
"net"
...
...
@@ -411,11 +412,41 @@ func (c *Conn) Close() error {
}
// for convinience: Dial/Listen
// Connect to address on named network and wrap the connection as NodeLink
// TODO +tls.Config
func
Dial
(
ctx
context
.
Context
,
network
,
address
string
)
(
*
NodeLink
,
error
)
{
d
:=
net
.
Dialer
{}
peerConn
,
err
:=
d
.
DialContext
(
ctx
,
network
,
address
)
if
err
!=
nil
{
return
nil
,
err
}
return
NewNodeLink
(
peerConn
,
LinkClient
),
nil
}
// like net.Listener but Accept returns net.Conn wrapped in NodeLink
type
Listener
struct
{
net
.
Listener
}
func
(
l
*
Listener
)
Accept
()
(
*
NodeLink
,
error
)
{
peerConn
,
err
:=
l
.
Listener
.
Accept
()
if
err
!=
nil
{
return
nil
,
err
}
return
NewNodeLink
(
peerConn
,
LinkServer
),
nil
}
// TODO +tls.Config +ctx
func
Listen
(
network
,
laddr
string
)
(
*
Listener
,
error
)
{
l
,
err
:=
net
.
Listen
(
network
,
laddr
)
if
err
!=
nil
{
return
nil
,
err
}
return
&
Listener
{
l
},
nil
}
// TODO
//func Dial(ctx context.Context, network, address string) (*NodeLink, error) // + tls.Config
//func Listen(network, laddr string) (net.Listener, error) // + tls.Config
// ln.Accept -> will return net.Conn wrapped in NodeLink
...
...
t/neo/proto.go
View file @
3a012847
...
...
@@ -169,7 +169,7 @@ type RequestIdentification struct {
ProtocolVersion
uint32
// TODO py.PProtocol upon decoding checks for != PROTOCOL_VERSION
NodeType
NodeType
// XXX name
UUID
UUID
Address
Address
// where requesting node is also accepting connectios
Name
string
IdTimestamp
Float64
}
...
...
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