def data_received(self, data): try: self.conn.receive_data(data) except RemoteProtocolError as err: if err.event_hint is not None: self.transport.write(self.conn.send(err.event_hint)) self.transport.close() else: self.handle_no_connect(events.CloseConnection()) else: self.handle_events()
def doclose(self): self._send(events.CloseConnection(code=0))