def add_handler(self, handlers, callback, method, mux): socks = [] if self.v6: socks.append(self.v6) if self.v4: socks.append(self.v4) handlers.append( Handler(socks, lambda sock: callback(sock, method, mux, handlers)))
def got_host_req(data): if not hw.pid: (hw.pid, hw.sock) = start_hostwatch(data.strip().split(), auto_hosts) handlers.append(Handler(socks=[hw.sock], callback=hostwatch_ready))