@@ -40,14 +40,12 @@ def _find_node_id(self):
4040
4141 async def watch_expire (self ):
4242 while True :
43- logger .info ("Checking expirations" )
4443 current_manifest = self .get_connection_manifest ()
4544 for connection in current_manifest :
4645 buffer = self .config .components .buffer_manager .get_buffer_for_node (connection ["id" ], self )
4746 for ident , message in buffer :
4847 message_actual = json .loads (message )
49- logger .info ("Examining {}" .format (message_data ))
50- if "expire_time" in message_data and message_data ['expire_time' ] < time .time ():
48+ if "expire_time" in message_actual and message_actual ['expire_time' ] < time .time ():
5149 logger .info ("Expiring message {}:{}" .format (ident , connection ["id" ]))
5250 expired_message = buffer .read_message (ident , remove = True )
5351 # TODO: Do something with expired message
@@ -83,7 +81,7 @@ def update_connection_manifest(self, connection):
8381 found = True
8482 break
8583 if not found :
86- manifest .append (dict (id = connection . id_ ,
84+ manifest .append (dict (id = connection ,
8785 last = time .time ()))
8886 self .write_connection_manifest (manifest )
8987
@@ -102,19 +100,19 @@ def add_connection(self, id_, protocol_obj):
102100 return conn
103101
104102 def remove_connection (self , protocol_obj ):
105- notify_protocols = []
106- #self.update_connection_manifest(conn)
103+ notify_connections = []
107104 for connection_node in self .connections :
108105 if protocol_obj in self .connections [connection_node ]:
109106 logger .info ("Removing connection {} for node {}" .format (protocol_obj , connection_node ))
110107 self .update_connection_manifest (connection_node )
111108 self .connections [connection_node ].remove (protocol_obj )
112109 self .router .update_node (self .node_id , connection_node , 100 )
113110 self .router .debug_router ()
114- notify_protocols += self .connections [connection_node ]
111+ self .update_connection_manifest (connection_node )
112+ notify_connections += self .connections [connection_node ]
115113 # TODO: Broadcast update, set timer for full expiration
116- for active_protocol in notify_protocols :
117- active_protocol .send_route_advertisement (self .router .get_edges ())
114+ for active_connection in notify_connections :
115+ active_connection .send_route_advertisement (self .router .get_edges ())
118116
119117 async def shutdown_handler (self ):
120118 while True :
0 commit comments