Esempio n. 1
0
 def dataReceived(self, data):
     try:
         self.timeout_checker.cancel()
     except:
         pass
     self.info("response received from the Service Events HTTP server ")
     #self.debug(data)
     cmd, headers = utils.parse_http_response(data)
     self.debug("%r %r", cmd, headers)
     if int(cmd[1]) != 200:
         self.warning("response with error code %r received upon our %r request", cmd[1], self.action)
         # XXX get around devices that return an error on our event subscribe request
         self.service.process_event({})
     else:
         try:
             self.service.set_sid(headers['sid'])
             timeout = headers['timeout']
             self.debug("%r %r", headers['sid'], headers['timeout'])
             if timeout == 'infinite':
                 self.service.set_timeout(time.time() + 4294967296) # FIXME: that's lame
             elif timeout.startswith('Second-'):
                 timeout = int(timeout[len('Second-'):])
                 self.service.set_timeout(timeout)
         except:
             #print headers
             pass
     self.teardown()
Esempio n. 2
0
 def dataReceived(self, data):
     try:
         self.timeout_checker.cancel()
     except:
         pass
     cmd, headers = utils.parse_http_response(data)
     self.debug( "notification response received %r %r", cmd, headers)
     try:
         if int(cmd[1]) != 200:
             self.warning("response with error code %r received upon our notification", cmd[1])
     except:
         self.debug("response without error code received upon our notification")
     self.transport.loseConnection()