Commit 4dc29017 authored by Vincent Pelletier's avatar Vincent Pelletier

Make client handler classes inherit from EventHandler directly.

MasterHandler contains only server-side handlers.
parent 749c2bd1
...@@ -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()
......
...@@ -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(MasterHandler): class PrimaryHandler(EventHandler):
""" 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):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment