Skip to content

Commit

Permalink
Merge pull request senko#3 from stanvit/master
Browse files Browse the repository at this point in the history
Early client.close() and potential upstream.close() issue
  • Loading branch information
senko committed Jan 4, 2013
2 parents 55c45f8 + f42720b commit f9c2b48
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tornado_proxy/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,18 @@ def read_from_client(data):
def read_from_upstream(data):
client.write(data)

def client_close(_dummy):
def client_close(data=None):
if upstream.closed():
return
if data:
upstream.write(data)
upstream.close()

def upstream_close(_dummy):
def upstream_close(data=None):
if client.closed():
return
if data:
client.write(data)
client.close()

def start_tunnel():
Expand Down

0 comments on commit f9c2b48

Please sign in to comment.