def _process_disconnect(self, packet): #ie: ("disconnect", "version error", "incompatible version") reason = bytestostr(packet[1]) info = packet[2:] s = nonl(reason) if len(info): s += " (%s)" % (", ".join([nonl(bytestostr(x)) for x in info])) if self.server_capabilities is None or len( self.server_capabilities) == 0: #server never sent hello to us - so disconnect is an error #(but we don't know which one - the info message may help) log.warn( "server failure: disconnected before the session could be established" ) e = EXIT_FAILURE elif disconnect_is_an_error(reason): log.warn("server failure: %s", reason) e = EXIT_FAILURE else: if self.exit_code is None: #we're not in the process of exiting already, #tell the user why the server is disconnecting us log.info("server requested disconnect: %s", s) self.quit(EXIT_OK) return self.warn_and_quit(e, "server requested disconnect: %s" % s)
def _process_disconnect(self, packet): #overriden method so we can avoid printing a warning, #we haven't received the hello back from the server #but that's fine for a request client info = tuple(nonl(bytestostr(x)) for x in packet[1:]) reason = info[0] if disconnect_is_an_error(reason): self.server_disconnect_warning(*info) elif self.exit_code is None: #we're not in the process of exiting already, #tell the user why the server is disconnecting us self.server_disconnect(*info)
def server_disconnect_exit_code(self, reason, *extra_info): if self.exit_code is None and (LOG_DISCONNECT or disconnect_is_an_error(reason)): l = log.info else: l = log l("server requested disconnect:") l(" %s", reason) for x in extra_info: l(" %s", x) if reason==SERVER_UPGRADE: return EXIT_UPGRADE return EXIT_OK
def _process_disconnect(self, packet): #ie: ("disconnect", "version error", "incompatible version") info = tuple(nonl(bytestostr(x)) for x in packet[1:]) reason = info[0] if not self.server_capabilities: #server never sent hello to us - so disconnect is an error #(but we don't know which one - the info message may help) self.server_disconnect_warning("disconnected before the session could be established", *info) elif disconnect_is_an_error(reason): self.server_disconnect_warning(*info) elif self.exit_code is None: #we're not in the process of exiting already, #tell the user why the server is disconnecting us self.server_disconnect(*info)
def _process_disconnect(self, packet): #ie: ("disconnect", "version error", "incompatible version") reason = bytestostr(packet[1]) info = packet[2:] s = nonl(reason) if len(info): s += " (%s)" % (", ".join([nonl(bytestostr(x)) for x in info])) if self.server_capabilities is None or len(self.server_capabilities)==0: #server never sent hello to us - so disconnect is an error #(but we don't know which one - the info message may help) log.warn("server failure: disconnected before the session could be established") e = EXIT_FAILURE elif disconnect_is_an_error(reason): log.warn("server failure: %s", reason) e = EXIT_FAILURE else: e = EXIT_OK self.warn_and_quit(e, "server requested disconnect: %s" % s)
def _process_disconnect(self, packet): #ie: ("disconnect", "version error", "incompatible version") reason = ss(packet[1]) info = packet[2:] s = nonl(reason) if len(info): s += " (%s)" % (", ".join([nonl(ss(x)) for x in info])) if self.server_capabilities is None or len(self.server_capabilities)==0: #server never sent hello to us - so disconnect is an error #(but we don't know which one - the info message may help) log.warn("server failure: disconnected before the session could be established") e = EXIT_FAILURE elif disconnect_is_an_error(reason): log.warn("server failure: %s", reason) e = EXIT_FAILURE else: e = EXIT_OK self.warn_and_quit(e, "server requested disconnect: %s" % s)