Ejemplo n.º 1
0
 async def close(self):
     if not self.started:
         log.debug('Do nothing because session is not started')
         return
     if self.closing:
         return
     self.closing = True
     if self.repair_loop_task:
         self.repair_loop_task.cancel()
         await asyncio.wait_for(self.send(protocol.CloseRequest()),
                                self.timeout,
                                loop=self.loop)
     if self.state.current_state != States.LOST:
         self.state.transition_to(States.LOST)
     if self.conn:
         await self.conn.close(self.timeout)
Ejemplo n.º 2
0
 async def close(self):
     if not self.started:
         log.debug('Do nothing because session is not started')
         return
     if self.closing:
         return
     self.closing = True
     if self.repair_loop_task:
         self.repair_loop_task.cancel()
         await asyncio.wait_for(self.send(protocol.CloseRequest()),
                                self.timeout)
     if self.state.current_state != States.LOST:
         self.state.transition_to(States.LOST)
     if self.conn:
         await self.conn.close(self.timeout)
     if self.heartbeat_handle:
         self.heartbeat_handle.cancel()
         self.heartbeat_handle = None
     if self.heartbeat_task and not self.heartbeat_task.done():
         self.heartbeat_task.cancel()
         self.heartbeat_task = None
     self.closing = False
     self.started = False
Ejemplo n.º 3
0
 async def close(self):
     self.closing = True
     await self.send(protocol.CloseRequest())
     self.state.transition_to(States.LOST)
     await self.conn.close(self.timeout)