Commit 57f8d9ab authored by Vincent Pelletier's avatar Vincent Pelletier

It has no meaning to require to send cluster name when changing it state: a...

It has no meaning to require to send cluster name when changing it state: a connection can be made to only one cluster at a time, and cluster name coherency is checked upon initial handshake.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1013 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 3612e024
......@@ -81,11 +81,10 @@ class AdminEventHandler(EventHandler):
msg_id = master_conn.ask(p)
self.app.dispatcher.register(msg_id, conn, {'msg_id' : packet.getId()})
def handleSetClusterState(self, conn, packet, name, state):
self.checkClusterName(name)
def handleSetClusterState(self, conn, packet, state):
# forward to primary
master_conn = self.app.master_conn
p = protocol.setClusterState(name, state)
p = protocol.setClusterState(state)
msg_id = master_conn.ask(p)
self.app.dispatcher.register(msg_id, conn, {'msg_id' : packet.getId()})
......
......@@ -351,7 +351,7 @@ class EventHandler(object):
def handleAnswerClusterState(self, conn, packet, state):
raise UnexpectedPacketError
def handleSetClusterState(self, conn, packet, name, state):
def handleSetClusterState(self, conn, packet, state):
raise UnexpectedPacketError
def handleNotifyClusterInformation(self, conn, packet, state):
......
......@@ -34,8 +34,7 @@ class AdministrationHandler(MasterHandler):
# I'm the primary
conn.answer(protocol.answerPrimaryMaster(app.uuid, []), packet)
def handleSetClusterState(self, conn, packet, name, state):
self.checkClusterName(name)
def handleSetClusterState(self, conn, packet, state):
self.app.changeClusterState(state)
p = protocol.noError('cluster state changed')
conn.answer(p, packet)
......
......@@ -1069,9 +1069,8 @@ decode_table[ANSWER_CLUSTER_STATE] = _decodeAnswerClusterState
@handle_errors
def _decodeSetClusterState(body):
(state, ) = unpack('!H', body[:2])
(name, _) = _readString(body, 'name', offset=2)
state = _decodeClusterState(state)
return (name, state)
return (state, )
decode_table[SET_CLUSTER_STATE] = _decodeSetClusterState
@handle_errors
......@@ -1438,9 +1437,8 @@ def answerClusterState(state):
body = pack('!H', state)
return Packet(ANSWER_CLUSTER_STATE, body)
def setClusterState(name, state):
body = [pack('!HL', state, len(name)), name]
body = ''.join(body)
def setClusterState(state):
body = pack('!H', state)
return Packet(SET_CLUSTER_STATE, body)
def notifyClusterInformation(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