Beispiel #1
0
 def _finish(self, channelID):
     ep = self.eps[channelID]
     if ep:
         if ep.closed:
             # `ep` is also closed in the reverse direction
             del self.eps[channelID]
         loop.run(self.epControl.requestCloseChannel(channelID, ep.myIDF))
Beispiel #2
0
 async def _connect_p1(self):
     conST = await self._connectToServer()
     if not conST:
         return False
     conST.setKeepAlive()
     self.log(Etypes.ConnectAuth)
     ok = await self._authenticate(conST)
     if not ok:
         return False
     self.conST = conST
     self.reminderRX.skipNext = True
     self.reminderRX.enabled = True
     loop.run(self.rtask())
     return True
Beispiel #3
0
 def actionNewChannel(self, data):
     assert len(data) > 12
     loop.run(self._actionNewChannel(data))
Beispiel #4
0
 def runConnect(self):
     if not self.connect.isPendingOrComplete():
         loop.run(self.connect())
Beispiel #5
0
 def handleRemindTX(self):
     if self.connect.isComplete():
         loop.run(self.requestKA())
Beispiel #6
0
 def _remove(self, channelID):
     ep = self.eps[channelID]
     if ep:
         del self.eps[channelID]
         loop.run(self.epControl.requestDeleteChannel(channelID, ep.myIDF))
Beispiel #7
0
 def connectionLost(self, reason='N/A'):
     self.log(Etypes.ConnectionLost, reason)
     if self.isIdle():
         self.disconnect()
     else:
         loop.run(self.reconnect())
Beispiel #8
0
 def connectToRelay(self, tokenP, tokenR, relayPort, relayAddr):
     # Todo: uncomment isIdle() condition
     # if self.isIdle():
     self.disconnect()
     loop.run(self.connect(info=(tokenP, tokenR, relayPort, relayAddr)))
     return True
Beispiel #9
0
 def rtask(self):
     self.log(Etypes.NewConnection)
     self.readable.off()
     loop.run(self.main())