X Tutup
Skip to content

Commit d8f0ffc

Browse files
authored
v1.8.4
1 parent 5092661 commit d8f0ffc

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

pproxy/__doc__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__title__ = "pproxy"
2-
__version__ = "1.8.3"
2+
__version__ = "1.8.4"
33
__license__ = "MIT"
44
__description__ = "Proxy server that can tunnel among remote servers by regex rules."
55
__keywords__ = "proxy socks http shadowsocks shadowsocksr ssr redirect pf tunnel cipher ssl udp"

pproxy/server.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -255,17 +255,23 @@ async def open_connection(self, host, port, local_addr, lbind):
255255
if not self.streams.done():
256256
await self.streams
257257
return self.streams.result()
258-
if self.direct:
259-
if host == 'tunnel':
260-
raise Exception('Unknown tunnel endpoint')
261-
local_addr = local_addr if lbind == 'in' else (lbind, 0) if lbind else None
262-
wait = asyncio.open_connection(host=host, port=port, local_addr=local_addr)
263-
elif self.unix:
264-
wait = asyncio.open_unix_connection(path=self.bind, ssl=self.sslclient, server_hostname='' if self.sslclient else None)
265-
else:
266-
local_addr = local_addr if self.lbind == 'in' else (self.lbind, 0) if self.lbind else None
267-
wait = asyncio.open_connection(host=self.host_name, port=self.port, ssl=self.sslclient, local_addr=local_addr)
268-
reader, writer = await asyncio.wait_for(wait, timeout=SOCKET_TIMEOUT)
258+
try:
259+
if self.direct:
260+
if host == 'tunnel':
261+
raise Exception('Unknown tunnel endpoint')
262+
local_addr = local_addr if lbind == 'in' else (lbind, 0) if lbind else None
263+
wait = asyncio.open_connection(host=host, port=port, local_addr=local_addr)
264+
elif self.unix:
265+
wait = asyncio.open_unix_connection(path=self.bind, ssl=self.sslclient, server_hostname='' if self.sslclient else None)
266+
else:
267+
local_addr = local_addr if self.lbind == 'in' else (self.lbind, 0) if self.lbind else None
268+
wait = asyncio.open_connection(host=self.host_name, port=self.port, ssl=self.sslclient, local_addr=local_addr)
269+
reader, writer = await asyncio.wait_for(wait, timeout=SOCKET_TIMEOUT)
270+
except Exception as ex:
271+
if self.reuse:
272+
self.streams.set_exception(ex)
273+
self.streams = None
274+
raise
269275
return reader, writer
270276
def prepare_connection(self, reader_remote, writer_remote, host, port):
271277
if self.reuse and not self.handler:

0 commit comments

Comments
 (0)
X Tutup