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
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
Iliya Manolov
neoppod
Commits
d62476dd
Commit
d62476dd
authored
Jan 06, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make setDown() consistent with update() with a down node.
parent
8ae3f0ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
neo/lib/node.py
neo/lib/node.py
+9
-3
No files found.
neo/lib/node.py
View file @
d62476dd
...
@@ -58,10 +58,14 @@ class Node(object):
...
@@ -58,10 +58,14 @@ class Node(object):
def
setState
(
self
,
new_state
):
def
setState
(
self
,
new_state
):
if
self
.
_state
==
new_state
:
if
self
.
_state
==
new_state
:
return
return
old_state
=
self
.
_state
if
new_state
==
NodeStates
.
DOWN
:
self
.
_state
=
new_state
self
.
_manager
.
remove
(
self
)
self
.
_state
=
new_state
else
:
old_state
=
self
.
_state
self
.
_state
=
new_state
self
.
_manager
.
_updateState
(
self
,
old_state
)
self
.
_last_state_change
=
time
()
self
.
_last_state_change
=
time
()
self
.
_manager
.
_updateState
(
self
,
old_state
)
def
setAddress
(
self
,
address
):
def
setAddress
(
self
,
address
):
if
self
.
_address
==
address
:
if
self
.
_address
==
address
:
...
@@ -268,6 +272,7 @@ class NodeManager(object):
...
@@ -268,6 +272,7 @@ class NodeManager(object):
if
node
in
self
.
_node_set
:
if
node
in
self
.
_node_set
:
neo
.
lib
.
logging
.
warning
(
'adding a known node %r, ignoring'
,
node
)
neo
.
lib
.
logging
.
warning
(
'adding a known node %r, ignoring'
,
node
)
return
return
assert
not
node
.
isDown
(),
node
self
.
_node_set
.
add
(
node
)
self
.
_node_set
.
add
(
node
)
self
.
_updateAddress
(
node
,
None
)
self
.
_updateAddress
(
node
,
None
)
self
.
_updateUUID
(
node
,
None
)
self
.
_updateUUID
(
node
,
None
)
...
@@ -334,6 +339,7 @@ class NodeManager(object):
...
@@ -334,6 +339,7 @@ class NodeManager(object):
set_dict
.
setdefault
(
new_key
,
set
()).
add
(
node
)
set_dict
.
setdefault
(
new_key
,
set
()).
add
(
node
)
def
_updateState
(
self
,
node
,
old_state
):
def
_updateState
(
self
,
node
,
old_state
):
assert
not
node
.
isDown
(),
node
self
.
__updateSet
(
self
.
_state_dict
,
old_state
,
node
.
getState
(),
node
)
self
.
__updateSet
(
self
.
_state_dict
,
old_state
,
node
.
getState
(),
node
)
def
getList
(
self
,
node_filter
=
None
):
def
getList
(
self
,
node_filter
=
None
):
...
...
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