Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sshuttle
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pub
sshuttle
Commits
94566b5e
Commit
94566b5e
authored
May 31, 2011
by
Brian May
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split expiration into handling into another function.
parent
a8b71f63
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
client.py
client.py
+12
-5
No files found.
client.py
View file @
94566b5e
...
@@ -175,6 +175,16 @@ class FirewallClient:
...
@@ -175,6 +175,16 @@ class FirewallClient:
raise
Fatal
(
'cleanup:
%
r returned
%
d'
%
(
self
.
argv
,
rv
))
raise
Fatal
(
'cleanup:
%
r returned
%
d'
%
(
self
.
argv
,
rv
))
dnsreqs
=
{}
def
expire_connections
(
now
,
mux
):
for
chan
,(
peer
,
sock
,
timeout
)
in
dnsreqs
.
items
():
if
timeout
<
now
:
debug3
(
'expiring dnsreqs channel=
%
d peer=
%
r
\n
'
%
(
chan
,
peer
))
del
mux
.
channels
[
chan
]
del
dnsreqs
[
chan
]
debug3
(
'Remaining DNS requests:
%
d
\n
'
%
len
(
dnsreqs
))
def
onaccept
(
listener
,
mux
,
handlers
):
def
onaccept
(
listener
,
mux
,
handlers
):
global
_extra_fd
global
_extra_fd
try
:
try
:
...
@@ -207,9 +217,9 @@ def onaccept(listener, mux, handlers):
...
@@ -207,9 +217,9 @@ def onaccept(listener, mux, handlers):
mux
.
send
(
chan
,
ssnet
.
CMD_CONNECT
,
'
%
s,
%
s'
%
dstip
)
mux
.
send
(
chan
,
ssnet
.
CMD_CONNECT
,
'
%
s,
%
s'
%
dstip
)
outwrap
=
MuxWrapper
(
mux
,
chan
)
outwrap
=
MuxWrapper
(
mux
,
chan
)
handlers
.
append
(
Proxy
(
SockWrapper
(
sock
,
sock
),
outwrap
))
handlers
.
append
(
Proxy
(
SockWrapper
(
sock
,
sock
),
outwrap
))
expire_connections
(
time
.
time
(),
mux
)
dnsreqs
=
{}
def
dns_done
(
chan
,
data
):
def
dns_done
(
chan
,
data
):
peer
,
sock
,
timeout
=
dnsreqs
.
get
(
chan
)
or
(
None
,
None
,
None
)
peer
,
sock
,
timeout
=
dnsreqs
.
get
(
chan
)
or
(
None
,
None
,
None
)
debug3
(
'dns_done: channel=
%
r peer=
%
r
\n
'
%
(
chan
,
peer
))
debug3
(
'dns_done: channel=
%
r peer=
%
r
\n
'
%
(
chan
,
peer
))
...
@@ -228,10 +238,7 @@ def ondns(listener, mux, handlers):
...
@@ -228,10 +238,7 @@ def ondns(listener, mux, handlers):
dnsreqs
[
chan
]
=
peer
,
listener
,
now
+
30
dnsreqs
[
chan
]
=
peer
,
listener
,
now
+
30
mux
.
send
(
chan
,
ssnet
.
CMD_DNS_REQ
,
pkt
)
mux
.
send
(
chan
,
ssnet
.
CMD_DNS_REQ
,
pkt
)
mux
.
channels
[
chan
]
=
lambda
cmd
,
data
:
dns_done
(
chan
,
data
)
mux
.
channels
[
chan
]
=
lambda
cmd
,
data
:
dns_done
(
chan
,
data
)
for
chan
,(
peer
,
sock
,
timeout
)
in
dnsreqs
.
items
():
expire_connections
(
now
,
mux
)
if
timeout
<
now
:
del
dnsreqs
[
chan
]
debug3
(
'Remaining DNS requests:
%
d
\n
'
%
len
(
dnsreqs
))
def
_main
(
listener
,
fw
,
ssh_cmd
,
remotename
,
python
,
latency_control
,
def
_main
(
listener
,
fw
,
ssh_cmd
,
remotename
,
python
,
latency_control
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment