예제 #1
0
    def retransmissionEnded(self):
        """Transaction have failed (called at 9500ms)"""

        self.stun_timeout = 0.1
        self.request = 1

        if self.test == 1:
            # ********************************************************
            # If it's in the first test (see rfc3489)
            # UDP blocked --> exit
            print ' >> test 1 (first time)(timeout): UDP blocked'
            self.configuration[4] = 'UDP blocked'
            self.deferred.errback(failure.DefaultException("UDP blocked"))
            return

        elif self.test == 2:
            # ********************************************************
            # If it's in the second test (see rfc3489)
            if self.addressMatch:
                # Symmetric UDP Firewall --> exit
                print ' >> test 2 (timeout): Symmetric UDP Firewall'
                self.configuration[4] = 'Symmetric UDP Firewall'
                self.gotMappedAddress(self.configuration[2])
                return
            else:
                # Start Test 1 (second time)
                print ' >> test 2 (timeout)'
                print "    # Start test 1 (second time)"
                dummy,family,port,addr = struct.unpack( \
                    '!ccH4s', self.avtypeList["MAPPED-ADDRESS"])
                mappedAddress = (socket.inet_ntoa(addr), port)
                self.oldMappedAddress = mappedAddress
                self.test = 1
                dummy,family,port,addr = struct.unpack( \
                    '!ccH4s', self.avtypeList["CHANGED-ADDRESS"])
                server = (socket.inet_ntoa(addr), port)
                self.sendRequest(server)
                return

        # If it's in the third test (see rfc3489)
        elif self.test == 3:
            # Port restricted
            print ' >> test 3 (timeout): Port Restricted cone'
            self.configuration[1] = "Port Restricted cone"
            self.gotMappedAddress(self.configuration[3])
            return

        return
예제 #2
0
 def _later2():
     log.info("_later2")
     # checks the the command has been removed
     if len(_master.get_all_commands()) != 0:
         msg = "The command did not get removed"
         log.info(msg)
         _deferred.errback(
             failure.Failure(failure.DefaultException(msg)))
         log.info("failed")
     else:
         log.info("removing the looping call")
         if _master._looping_call.running:
             d = _master._looping_call.deferred
             _master._looping_call.stop()  # FIXME
             d.addCallback(_cb3)
         else:
             _deferred.callback(None)
예제 #3
0
 def foo():
     d.errback(
         failure.DefaultException(
             "This task also should never get called."))