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
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
Stefane Fermigier
neo
Commits
341b2124
Commit
341b2124
authored
Jun 14, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b78c529a
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
192 additions
and
131 deletions
+192
-131
go/neo/server/cluster_test.go
go/neo/server/cluster_test.go
+10
-2
go/xcommon/xnet/net.go
go/xcommon/xnet/net.go
+3
-1
go/xcommon/xnet/pipenet/pipenet.go
go/xcommon/xnet/pipenet/pipenet.go
+177
-128
go/xcommon/xnet/trace.go
go/xcommon/xnet/trace.go
+2
-0
No files found.
go/neo/server/cluster_test.go
View file @
341b2124
...
@@ -117,7 +117,12 @@ func (tc *TraceChecker) ExpectNetTx(src, dst string, pkt string) {
...
@@ -117,7 +117,12 @@ func (tc *TraceChecker) ExpectNetTx(src, dst string, pkt string) {
func
TestMasterStorage
(
t
*
testing
.
T
)
{
func
TestMasterStorage
(
t
*
testing
.
T
)
{
tracer
:=
&
MyTracer
{
xtesting
.
NewSyncTracer
()}
tracer
:=
&
MyTracer
{
xtesting
.
NewSyncTracer
()}
tc
:=
xtesting
.
NewTraceChecker
(
t
,
tracer
.
SyncTracer
)
tc
:=
xtesting
.
NewTraceChecker
(
t
,
tracer
.
SyncTracer
)
net
:=
xnet
.
NetTrace
(
pipenet
.
New
(
""
),
tracer
)
// test network
//net := xnet.NetTrace(pipenet.New(""), tracer) // test network
net
:=
pipenet
.
New
(
"testnet"
)
// test network
Mhost
:=
xnet
.
NetTrace
(
net
.
Host
(
"m"
),
tracer
)
Shost
:=
xnet
.
NetTrace
(
net
.
Host
(
"s"
),
tracer
)
Maddr
:=
"0"
Maddr
:=
"0"
Saddr
:=
"1"
Saddr
:=
"1"
...
@@ -125,7 +130,7 @@ func TestMasterStorage(t *testing.T) {
...
@@ -125,7 +130,7 @@ func TestMasterStorage(t *testing.T) {
wg
:=
&
xsync
.
WorkGroup
{}
wg
:=
&
xsync
.
WorkGroup
{}
// start master
// start master
M
:=
NewMaster
(
"abc1"
,
Maddr
,
ne
t
)
M
:=
NewMaster
(
"abc1"
,
Maddr
,
Mhos
t
)
Mctx
,
Mcancel
:=
context
.
WithCancel
(
context
.
Background
())
Mctx
,
Mcancel
:=
context
.
WithCancel
(
context
.
Background
())
wg
.
Gox
(
func
()
{
wg
.
Gox
(
func
()
{
err
:=
M
.
Run
(
Mctx
)
err
:=
M
.
Run
(
Mctx
)
...
@@ -158,6 +163,9 @@ func TestMasterStorage(t *testing.T) {
...
@@ -158,6 +163,9 @@ func TestMasterStorage(t *testing.T) {
//tc.Expect(nettx("2c", "2s", "\x00\x00\x00\x01"))
//tc.Expect(nettx("2c", "2s", "\x00\x00\x00\x01"))
// handshake
// handshake
tc
.
Expect
(
nettx
(
"s:1"
,
"m:1"
,
"
\x00\x00\x00\x01
"
))
tc
.
Expect
(
nettx
(
"m:1"
,
"s:1"
,
"
\x00\x00\x00\x01
"
))
//tc.ExpectNetTx("2c", "2s", "\x00\x00\x00\x01") // handshake
//tc.ExpectNetTx("2c", "2s", "\x00\x00\x00\x01") // handshake
//tc.ExpectNetTx("2s", "2c", "\x00\x00\x00\x01")
//tc.ExpectNetTx("2s", "2c", "\x00\x00\x00\x01")
tc
.
ExpectPar
(
tc
.
ExpectPar
(
...
...
go/xcommon/xnet/net.go
View file @
341b2124
...
@@ -30,11 +30,13 @@ type Networker interface {
...
@@ -30,11 +30,13 @@ type Networker interface {
// Network returns name of the network XXX recheck
// Network returns name of the network XXX recheck
Network
()
string
Network
()
string
// XXX +Addr() net.Addr -> address of this access-point on underlying network ?
// Dial connects to addr on underlying network
// Dial connects to addr on underlying network
// see net.Dial for semantic details
// see net.Dial for semantic details
Dial
(
ctx
context
.
Context
,
addr
string
)
(
net
.
Conn
,
error
)
Dial
(
ctx
context
.
Context
,
addr
string
)
(
net
.
Conn
,
error
)
// Listen starts listening on local address laddr on underlying network
// Listen starts listening on local address laddr on underlying network
access-point
// see net.Listen for semantic details
// see net.Listen for semantic details
//
//
// XXX also introduce xnet.Listener in which Accept() accepts also ctx?
// XXX also introduce xnet.Listener in which Accept() accepts also ctx?
...
...
go/xcommon/xnet/pipenet/pipenet.go
View file @
341b2124
This diff is collapsed.
Click to expand it.
go/xcommon/xnet/trace.go
View file @
341b2124
...
@@ -34,6 +34,8 @@ import (
...
@@ -34,6 +34,8 @@ import (
// only Tx events are traced:
// only Tx events are traced:
// - because Write, contrary to Read, never writes partial data on non-error
// - because Write, contrary to Read, never writes partial data on non-error
// - because in case of pipenet tracing writes only is enough to get whole network exchange picture
// - because in case of pipenet tracing writes only is enough to get whole network exchange picture
//
// XXX Dial/Listen are also traced
func
NetTrace
(
inner
Networker
,
tracer
Tracer
)
Networker
{
func
NetTrace
(
inner
Networker
,
tracer
Tracer
)
Networker
{
return
&
netTrace
{
inner
,
tracer
}
return
&
netTrace
{
inner
,
tracer
}
}
}
...
...
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