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
11ca3691
Commit
11ca3691
authored
Jun 14, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a379376c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
go/neo/server/cluster_test.go
go/neo/server/cluster_test.go
+8
-4
go/xcommon/xnet/trace.go
go/xcommon/xnet/trace.go
+2
-2
No files found.
go/neo/server/cluster_test.go
View file @
11ca3691
...
@@ -128,15 +128,21 @@ func TestMasterStorage(t *testing.T) {
...
@@ -128,15 +128,21 @@ func TestMasterStorage(t *testing.T) {
}
}
// shortcut for net tx event
// shortcut for net tx event
// XXX -> NetTx ?
nettx
:=
func
(
src
,
dst
,
pkt
string
)
*
xnet
.
TraceTx
{
nettx
:=
func
(
src
,
dst
,
pkt
string
)
*
xnet
.
TraceTx
{
return
&
xnet
.
TraceTx
{
Src
:
xaddr
(
src
),
Dst
:
xaddr
(
dst
),
Pkt
:
[]
byte
(
pkt
)}
return
&
xnet
.
TraceTx
{
Src
:
xaddr
(
src
),
Dst
:
xaddr
(
dst
),
Pkt
:
[]
byte
(
pkt
)}
}
}
// shortcut for net connect event
// shortcut for net connect event
// XXX -> NetConnect ?
netconnect
:=
func
(
src
,
dst
,
dialed
string
)
*
xnet
.
TraceConnect
{
netconnect
:=
func
(
src
,
dst
,
dialed
string
)
*
xnet
.
TraceConnect
{
return
&
xnet
.
TraceConnect
{
Src
:
xaddr
(
src
),
Dst
:
xaddr
(
dst
),
Dialed
:
dialed
}
return
&
xnet
.
TraceConnect
{
Src
:
xaddr
(
src
),
Dst
:
xaddr
(
dst
),
Dialed
:
dialed
}
}
}
netlisten
:=
func
(
laddr
string
)
*
xnet
.
TraceListen
{
return
&
xnet
.
TraceListen
{
Laddr
:
xaddr
(
laddr
)}
}
Mhost
:=
xnet
.
NetTrace
(
net
.
Host
(
"m"
),
tracer
)
Mhost
:=
xnet
.
NetTrace
(
net
.
Host
(
"m"
),
tracer
)
Shost
:=
xnet
.
NetTrace
(
net
.
Host
(
"s"
),
tracer
)
Shost
:=
xnet
.
NetTrace
(
net
.
Host
(
"s"
),
tracer
)
...
@@ -152,8 +158,7 @@ func TestMasterStorage(t *testing.T) {
...
@@ -152,8 +158,7 @@ func TestMasterStorage(t *testing.T) {
})
})
// expect:
// expect:
//tc.ExpectNetListen("0")
tc
.
Expect
(
netlisten
(
"m:0"
))
tc
.
Expect
(
&
xnet
.
TraceListen
{
Laddr
:
":0"
})
// M.clusterState <- RECOVERY
// M.clusterState <- RECOVERY
// M.nodeTab <- Node(M)
// M.nodeTab <- Node(M)
...
@@ -168,8 +173,7 @@ func TestMasterStorage(t *testing.T) {
...
@@ -168,8 +173,7 @@ func TestMasterStorage(t *testing.T) {
})
})
// expect:
// expect:
//tc.ExpectNetListen("1")
tc
.
Expect
(
netlisten
(
"s:0"
))
tc
.
Expect
(
&
xnet
.
TraceListen
{
Laddr
:
":0"
})
tc
.
Expect
(
netconnect
(
"s:1"
,
"m:1"
,
"m:0"
))
tc
.
Expect
(
netconnect
(
"s:1"
,
"m:1"
,
"m:0"
))
...
...
go/xcommon/xnet/trace.go
View file @
11ca3691
...
@@ -59,7 +59,7 @@ type TraceConnect struct {
...
@@ -59,7 +59,7 @@ type TraceConnect struct {
// TraceListen is event corresponding to network listening
// TraceListen is event corresponding to network listening
type
TraceListen
struct
{
type
TraceListen
struct
{
// XXX also put networker?
// XXX also put networker?
Laddr
string
Laddr
net
.
Addr
}
}
// TraceTx is event corresponding to network transmission
// TraceTx is event corresponding to network transmission
...
@@ -96,7 +96,7 @@ func (nt *netTrace) Listen(laddr string) (net.Listener, error) {
...
@@ -96,7 +96,7 @@ func (nt *netTrace) Listen(laddr string) (net.Listener, error) {
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
nt
.
tracer
.
TraceNetListen
(
&
TraceListen
{
Laddr
:
l
addr
})
nt
.
tracer
.
TraceNetListen
(
&
TraceListen
{
Laddr
:
l
.
Addr
()
})
return
&
netTraceListener
{
nt
,
l
},
nil
return
&
netTraceListener
{
nt
,
l
},
nil
}
}
...
...
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