def clientConnectionFailed(self, connector, reason):
     self.logger.error('Connection failed: %s - %s' % (reason.type, reason.value))
     registry.removeSession(self)
     self.state = base.STATE_DISCONNECTED
     if (error.ConnectionRefusedError == reason.type) or (error.TCPTimedOutError == reason.type) or (error.TimeoutError == reason.type):
         if self.peerType == base.CLIENT:
             self.notify(collab_event.FAILED_SESSION, self.sharingWithUser)
     self.disconnect()
 def clientConnectionLost(self, connector, reason):
     registry.removeSession(self)
     self.state = base.STATE_DISCONNECTED
     if error.ConnectionDone == reason.type:
         self.disconnect()
     else:
         status_bar.status_message('lost share session with %s' % self.str())
         # may want to reconnect, but for now lets print why
         self.logger.error('Connection lost: %s - %s' % (reason.type, reason.value))
 def connectionLost(self, reason):
     registry.removeSession(self)
     if self.peerType == base.CLIENT:
         # ignore this, clientConnectionLost() below will also be called
         return
     self.state = base.STATE_DISCONNECTED
     if error.ConnectionDone == reason.type:
         self.disconnect()
     else:
         status_bar.heartbeat_message('lost share session with %s' % self.str())
         # may want to reconnect, but for now lets print why
         self.logger.error('Connection lost: %s - %s' % (reason.type, reason.value))
 def run(self):
     global sessions
     global sessionsByViewId
     global sessionsLock
     time.sleep(5.0)
     # runs for as long as the reactor is running
     while reactor.running:
         sessionsLock.acquire()
         for session in registry.listSessions():
             if session.state == pi.STATE_DISCONNECTED:
                 logger.info('Cleaning up dead session: %s' % session.str())
                 registry.removeSession(session)
         sessionsLock.release()
         time.sleep(5.0)
示例#5
0
 def run(self):
     global sessions
     global sessionsByViewId
     global sessionsLock
     time.sleep(5.0)
     # runs for as long as the reactor is running
     while reactor.running:
         sessionsLock.acquire()
         for session in registry.listSessions():
             if session.state == pi.STATE_DISCONNECTED:
                 logger.info('Cleaning up dead session: %s' % session.str())
                 registry.removeSession(session)
         sessionsLock.release()
         time.sleep(5.0)
示例#6
0
 def privmsg(self, user, channel, message):
     """
     Handles incoming private messages from a given user on a given channel.
     This is used by the peer attempting to establish a session to recieve
     information from the peer recieving the session request.
     """
     username = user.lstrip(self.getNickPrefixes())
     if '!' in username:
         username = username.split('!', 1)[0]
     self.logger.debug('Received %s from %s' % (message, username))
     if message == base.SESSION_RETRY:
         registry.removeSession(self.pendingSession)
         self.pendingSession.disconnect()
         self.pendingSession = None
         self.negotiateSession(username)
     elif message == base.SESSION_FAILED:
         # client recvd from server... report error and cleanup any half-made sessions
         self.logger.warn(
             'All connections to all possible host ip addresses failed.')
         registry.removeSession(self.pendingSession)
         self.pendingSession.disconnect()
         self.pendingSession = None
     elif message == base.SESSION_REJECTED:
         # server recvd from client... report rejected and cleanup any half-made sessions
         self.logger.info('Request to share with user %s was rejected.' %
                          username)
         registry.removeSession(self.pendingSession)
         self.pendingSession.disconnect()
         self.pendingSession = None
示例#7
0
 def privmsg(self, user, channel, message):
     """
     Handles incoming private messages from a given user on a given channel.
     This is used by the peer attempting to establish a session to recieve
     information from the peer recieving the session request.
     """
     username = user.lstrip(self.getNickPrefixes())
     if '!' in username:
         username = username.split('!', 1)[0]
     self.logger.debug('Received %s from %s' % (message, username))
     if message == base.SESSION_RETRY:
         registry.removeSession(self.pendingSession)
         self.pendingSession.disconnect();
         self.pendingSession = None
         self.negotiateSession(username)
     elif message == base.SESSION_FAILED:
         # client recvd from server... report error and cleanup any half-made sessions
         self.logger.warn('All connections to all possible host ip addresses failed.')
         registry.removeSession(self.pendingSession)
         self.pendingSession.disconnect();
         self.pendingSession = None
     elif message == base.SESSION_REJECTED:
         # server recvd from client... report rejected and cleanup any half-made sessions
         self.logger.info('Request to share with user %s was rejected.' % username)
         registry.removeSession(self.pendingSession)
         self.pendingSession.disconnect();
         self.pendingSession = None