Write only when having data.

This commit is contained in:
ayanamist 2013-02-28 11:07:47 +08:00
parent 543d6db55a
commit af64aae7b6

View file

@ -115,10 +115,12 @@ class ConnHandler(PairedStream):
self.remote.read_until_close(callback=self.on_remote_read, streaming_callback=self.on_remote_read)
def on_client_read(self, data):
self.remote.write(crypto.encrypt(data))
if data:
self.remote.write(crypto.encrypt(data))
def on_remote_read(self, data):
self.write(crypto.decrypt(data))
if data:
self.write(crypto.decrypt(data))
if __name__ == "__main__":