Commit e31442dc authored by Grégory Wisniewski's avatar Grégory Wisniewski

Don't send client informations to client nodes.

git-svn-id: 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 7d984ac8
......@@ -299,11 +299,13 @@ class Application(object):
" Outdate cell of non-working nodes and broadcast changes """
def sendNodesInformations(self, conn):
def sendNodesInformations(self, conn, selector=None):
""" Send informations on all nodes through the given connection """
if selector is None:
selector = lambda node: not node.isAdmin()
node_list = []
for n in self.nm.getList():
if not n.isAdmin():
if selector(n):
# Split the packet if too huge.
if len(node_list) == 10000:
......@@ -38,6 +38,12 @@ class ClientServiceHandler(MasterHandler):
def askNodeInformation(self, conn):
# send informations about master and storages only
selector = lambda node: node.isMaster() or node.isStorage(), selector=selector)
def abortTransaction(self, conn, tid):
if tid in
......@@ -144,6 +144,18 @@ class MasterClientHandlerTests(NeoTestBase):
service.abortTransaction(conn, tid)
def test_askNodeInformations(self):
# check that only informations about master and storages nodes are
# send to a client
conn = self.getFakeConnection()
calls = conn.mockGetNamedCalls('notify')
self.assertEqual(len(calls), 1)
packet = calls[0].getParam(0)
(node_list, ) = packet.decode()
self.assertEqual(len(node_list), 2)
def __testWithMethod(self, method, state):
# give a client uuid which have unfinished transactions
client_uuid = self.identifyToMasterNode(node_type=NodeTypes.CLIENT,
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