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
4dc29017
Commit
4dc29017
authored
Feb 28, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make client handler classes inherit from EventHandler directly.
MasterHandler contains only server-side handlers.
parent
749c2bd1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
7 deletions
+4
-7
neo/master/handlers/election.py
neo/master/handlers/election.py
+2
-6
neo/master/handlers/secondary.py
neo/master/handlers/secondary.py
+2
-1
No files found.
neo/master/handlers/election.py
View file @
4dc29017
...
@@ -22,15 +22,11 @@ from neo.lib.protocol import NotReadyError, ProtocolError, \
...
@@ -22,15 +22,11 @@ from neo.lib.protocol import NotReadyError, ProtocolError, \
UnexpectedPacketError
UnexpectedPacketError
from
neo.lib.protocol
import
BrokenNodeDisallowedError
from
neo.lib.protocol
import
BrokenNodeDisallowedError
from
neo.lib.exception
import
ElectionFailure
from
neo.lib.exception
import
ElectionFailure
from
neo.lib.handler
import
EventHandler
from
neo.lib.util
import
dump
from
neo.lib.util
import
dump
from
.
import
MasterHandler
from
.
import
MasterHandler
class
ClientElectionHandler
(
MasterHandler
):
class
ClientElectionHandler
(
EventHandler
):
# FIXME: this packet is not allowed here, but handled in MasterHandler
# a global handler review is required.
def
askPrimary
(
self
,
conn
):
raise
UnexpectedPacketError
,
"askPrimary on server connection"
def
connectionFailed
(
self
,
conn
):
def
connectionFailed
(
self
,
conn
):
addr
=
conn
.
getAddress
()
addr
=
conn
.
getAddress
()
...
...
neo/master/handlers/secondary.py
View file @
4dc29017
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from
.
import
MasterHandler
from
.
import
MasterHandler
from
neo.lib.handler
import
EventHandler
from
neo.lib.exception
import
ElectionFailure
,
PrimaryFailure
from
neo.lib.exception
import
ElectionFailure
,
PrimaryFailure
from
neo.lib.protocol
import
NodeTypes
,
Packets
from
neo.lib.protocol
import
NodeTypes
,
Packets
...
@@ -34,7 +35,7 @@ class SecondaryMasterHandler(MasterHandler):
...
@@ -34,7 +35,7 @@ class SecondaryMasterHandler(MasterHandler):
def
reelectPrimary
(
self
,
conn
):
def
reelectPrimary
(
self
,
conn
):
raise
ElectionFailure
,
'reelection requested'
raise
ElectionFailure
,
'reelection requested'
class
PrimaryHandler
(
Master
Handler
):
class
PrimaryHandler
(
Event
Handler
):
""" Handler used by secondaries to handle primary master"""
""" Handler used by secondaries to handle primary master"""
def
connectionLost
(
self
,
conn
,
new_state
):
def
connectionLost
(
self
,
conn
,
new_state
):
...
...
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