def _remote_handler_eb(self, failure, ms_id, trans_id): if log.isEnabledFor(logging.DEBUG): log.info('remote call failure: %s', failure.value, exc_info=(failure.type, failure.value, failure.getTracebackObject())) else: log.info('remote call failure: %s', failure.value) fatal = False if failure.check(CallResultError): body = self.encode_amf('_error', trans_id, *failure.value.get_error_args()) fatal = failure.value.is_fatal else: err = amf0.Object(code='NetStream.Failed', level='error', description=repr(failure.value)) body = self.encode_amf('_error', trans_id, None, err) ts = ms_time_wrapped(self.session_time()) self.muxer.sendMessage(ts, chunks.MSG_COMMAND, ms_id, body) if fatal: self.transport.loseConnection()
def dataReceived(self, data): self._buf.write(data) while 1: # need to be able to retry immediately when handlers change try: while len(self._buf) >= self._toread: self._toread = self._handler.send(self._buf) break # no data, no retry except StopIteration: if self._handler_changed: self._handler_changed = False else: self._toread = None self._handler = None break except: # undocumented, but real; this way we can signal # protocol errors directly, and by not passing/raising # directly we avoid a stack trace log, with the same # effect - connectionLost f = failure.Failure() log.info(f.value, exc_info=log.isEnabledFor(logging.DEBUG)) return f
def log_failure(failure): # log the failure and consume it log.info(failure.value, exc_info=log.isEnabledFor(logging.DEBUG)) return None
def _fcpublish_failed(self, failure): self._state = None log.info('FCPublish failed: %r', failure.value, exc_info=log.isEnabledFor(logging.DEBUG)) return failure