Commit d4603189 authored by Julien Muchembled's avatar Julien Muchembled

admin: fix possible crash when connecting to upstream admin

This fixes:

  Traceback (most recent call last):
    File "neo/scripts/neoadmin.py", line 31, in main
      app.run()
    File "neo/admin/app.py", line 179, in run
      self._run()
    File "neo/admin/app.py", line 199, in _run
      self.em.poll(1)
    File "neo/lib/event.py", line 155, in poll
      self._poll(blocking)
    File "neo/lib/event.py", line 220, in _poll
      if conn.readable():
    File "neo/lib/connection.py", line 487, in readable
      self._closure()
    File "neo/lib/connection.py", line 545, in _closure
      self.close()
    File "neo/lib/connection.py", line 534, in close
      handler.connectionFailed(self)
    File "neo/admin/handler.py", line 210, in connectionClosed
      app.connectToUpstreamAdmin()
    File "neo/admin/app.py", line 230, in connectToUpstreamAdmin
      None, None, self.name, None, {}))
    File "neo/lib/connection.py", line 574, in ask
      raise ConnectionClosed
  neo.lib.connection.ConnectionClosed
parent 71796c8b
......@@ -240,10 +240,8 @@ class Application(BaseApplication, Monitor):
def connectToUpstreamAdmin(self):
if self.listening_conn: # if running
conn = self.upstream_admin_conn = ClientConnection(
self.upstream_admin_conn = ClientConnection(
self, self.upstream_admin_handler, self.upstream_admin)
conn.ask(Packets.RequestIdentification(NodeTypes.ADMIN,
None, None, self.name, None, {}))
def partitionTableUpdated(self):
pt = self.pt
......
......@@ -213,6 +213,11 @@ class UpstreamAdminHandler(AdminEventHandler):
connectionFailed = connectionClosed
def connectionCompleted(self, conn):
super(UpstreamAdminHandler, self).connectionCompleted(conn)
conn.ask(Packets.RequestIdentification(NodeTypes.ADMIN,
None, None, self.app.name, None, {}))
def _acceptIdentification(self, node):
node.send(Packets.NotifyMonitorInformation({
'cluster_state': self.app.cluster_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