def piper(self, in_sock, out_sock, out_addr, onkill):
try:<EOL><INDENT>while True:<EOL><INDENT>written = in_sock.recv(<NUM_LIT>)<EOL>if not written:<EOL><INDENT>try:<EOL><INDENT>out_sock.shutdown(socket.SHUT_WR)<EOL><DEDENT>except socket.error:<EOL><INDENT>self.threads[onkill].kill()<EOL><DEDENT>break<EOL><DEDENT>try:<EOL><INDENT>out_sock.sendall(written)<EOL><DEDENT>except socket.error:<EOL><INDENT>pass<EOL><DEDENT>self.data_handled += len(written)<EOL><DEDENT><DEDENT>except greenlet.GreenletExit:<EOL><INDENT>return<EOL><DEDENT>
Worker thread for data reading