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
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
ae042175
Commit
ae042175
authored
Feb 24, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
af92856b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
15 deletions
+22
-15
go/neo/xneo/nodetab.go
go/neo/xneo/nodetab.go
+15
-14
go/neo/xneo/statelog.go
go/neo/xneo/statelog.go
+6
-0
go/neo/xneo/xneo.go
go/neo/xneo/xneo.go
+1
-1
No files found.
go/neo/xneo/nodetab.go
View file @
ae042175
...
...
@@ -325,17 +325,18 @@ type dialed struct {
// In case Dial returns an error - future Dial will attempt to reconnect with
// "don't reconnect too fast" throttling.
func
(
p
*
PeerNode
)
Dial
(
ctx
context
.
Context
)
(
*
neonet
.
NodeLink
,
error
)
{
p
.
linkMu
.
Lock
()
l
:=
p
.
link
l
.
linkMu
.
Lock
()
// ok if already connected
if
link
:=
p
.
link
;
link
!=
nil
{
p
.
linkMu
.
Unlock
()
if
link
:=
l
.
link
;
link
!=
nil
{
l
.
linkMu
.
Unlock
()
return
link
,
nil
}
// if dial is already in progress - wait for its completion
if
dialing
:=
p
.
dialing
;
dialing
!=
nil
{
p
.
linkMu
.
Unlock
()
if
dialing
:=
l
.
dialing
;
dialing
!=
nil
{
l
.
linkMu
.
Unlock
()
select
{
case
<-
ctx
.
Done
()
:
...
...
@@ -351,10 +352,10 @@ func (p *PeerNode) Dial(ctx context.Context) (*neonet.NodeLink, error) {
// XXX p.State != RUNNING
// XXX p.Addr != ""
dialT
:=
p
.
dialT
dialT
:=
l
.
dialT
dialing
:=
&
dialed
{
ready
:
make
(
chan
struct
{})}
p
.
dialing
=
dialing
p
.
linkMu
.
Unlock
()
l
.
dialing
=
dialing
l
.
linkMu
.
Unlock
()
go
func
()
{
link
,
err
:=
func
()
(
*
neonet
.
NodeLink
,
error
)
{
...
...
@@ -370,16 +371,16 @@ func (p *PeerNode) Dial(ctx context.Context) (*neonet.NodeLink, error) {
}
}
link
,
err
:=
p
.
dial
(
ctx
)
link
,
err
:=
l
.
dial
(
ctx
)
dialT
=
time
.
Now
()
return
link
,
err
}()
p
.
linkMu
.
Lock
()
p
.
link
=
link
p
.
dialT
=
dialT
p
.
dialing
=
nil
p
.
linkMu
.
Unlock
()
l
.
linkMu
.
Lock
()
l
.
link
=
link
l
.
dialT
=
dialT
l
.
dialing
=
nil
l
.
linkMu
.
Unlock
()
dialing
.
link
=
link
dialing
.
err
=
err
...
...
go/neo/xneo/statelog.go
View file @
ae042175
...
...
@@ -20,6 +20,12 @@
package
xneo
// transactional log of states
import
(
"sync"
"lab.nexedi.com/kirr/neo/go/neo/proto"
)
// State represents state of a cluster.
type
State
struct
{
// XXX +transaction ID?
...
...
go/neo/xneo/xneo.go
View file @
ae042175
...
...
@@ -23,7 +23,7 @@ package xneo
//go:generate gotrace gen .
import
(
"sync"
//
"sync"
"lab.nexedi.com/kirr/go123/xnet"
"lab.nexedi.com/kirr/neo/go/neo/proto"
...
...
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