def found_terminator(self): data, self.buffer = self.buffer, '' if not data: asyncore.close_all() print "done" return n = string.atoi(string.split(data)[0]) tf = trigger_file(self) self.count = self.count + 1 thread.start_new_thread(thread_function, (tf, self.count, n))
def found_terminator (self): data, self.buffer = self.buffer, '' if not data: asyncore.close_all() print "done" return n = string.atoi (string.split (data)[0]) tf = trigger_file (self) self.count = self.count + 1 thread.start_new_thread (thread_function, (tf, self.count, n))
def test (port='8021'): fs = ftp_server ( unix_authorizer(), port=string.atoi (port) ) try: asyncore.loop() except KeyboardInterrupt: fs.log_info('FTP server shutting down. (received SIGINT)', 'warning') # close everything down on SIGINT. # of course this should be a cleaner shutdown. asyncore.close_all()
def found_terminator(self): data, self.buffer = self.buffer, '' if not data: asyncore.close_all() print "done" return n = string.atoi(string.split(data)[0]) tf = trigger_file(self) self.count = self.count + 1 thread.start_new_thread(thread_function, (tf, self.count, n)) class thread_server(asyncore.dispatcher): def __init__(self, family=socket.AF_INET, address=('', 9003)): asyncore.dispatcher.__init__(self) self.create_socket(family, socket.SOCK_STREAM) self.set_reuse_addr() self.bind(address) self.listen(5) def handle_accept(self): conn, addr = self.accept() tp = thread_parent(conn, addr) thread_server() #asyncore.loop(1.0, use_poll=1) try: asyncore.loop() except: asyncore.close_all()
def found_terminator (self): data, self.buffer = self.buffer, '' if not data: asyncore.close_all() print "done" return n = string.atoi (string.split (data)[0]) tf = trigger_file (self) self.count = self.count + 1 thread.start_new_thread (thread_function, (tf, self.count, n)) class thread_server (asyncore.dispatcher): def __init__ (self, family=socket.AF_INET, address=('', 9003)): asyncore.dispatcher.__init__ (self) self.create_socket (family, socket.SOCK_STREAM) self.set_reuse_addr() self.bind (address) self.listen (5) def handle_accept (self): conn, addr = self.accept() tp = thread_parent (conn, addr) thread_server() #asyncore.loop(1.0, use_poll=1) try: asyncore.loop () except: asyncore.close_all()