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
98d052d1
Commit
98d052d1
authored
Aug 15, 2020
by
Dan Streetman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow Mux() flush/fill to work with python < 3.5
Fixes: #503
parent
be4b081a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
ssnet.py
sshuttle/ssnet.py
+15
-2
No files found.
sshuttle/ssnet.py
View file @
98d052d1
...
...
@@ -4,6 +4,7 @@ import socket
import
errno
import
select
import
os
import
fcntl
from
sshuttle.helpers
import
b
,
log
,
debug1
,
debug2
,
debug3
,
Fatal
...
...
@@ -436,7 +437,13 @@ class Mux(Handler):
callback
(
cmd
,
data
)
def
flush
(
self
):
try
:
os
.
set_blocking
(
self
.
wfile
.
fileno
(),
False
)
except
AttributeError
:
# python < 3.5
flags
=
fcntl
.
fcntl
(
self
.
wfile
.
fileno
(),
fcntl
.
F_GETFL
)
flags
|=
os
.
O_NONBLOCK
flags
=
fcntl
.
fcntl
(
self
.
wfile
.
fileno
(),
fcntl
.
F_SETFL
,
flags
)
if
self
.
outbuf
and
self
.
outbuf
[
0
]:
wrote
=
_nb_clean
(
os
.
write
,
self
.
wfile
.
fileno
(),
self
.
outbuf
[
0
])
debug2
(
'mux wrote:
%
r/
%
d
\n
'
%
(
wrote
,
len
(
self
.
outbuf
[
0
])))
...
...
@@ -446,7 +453,13 @@ class Mux(Handler):
self
.
outbuf
[
0
:
1
]
=
[]
def
fill
(
self
):
try
:
os
.
set_blocking
(
self
.
rfile
.
fileno
(),
False
)
except
AttributeError
:
# python < 3.5
flags
=
fcntl
.
fcntl
(
self
.
rfile
.
fileno
(),
fcntl
.
F_GETFL
)
flags
|=
os
.
O_NONBLOCK
flags
=
fcntl
.
fcntl
(
self
.
rfile
.
fileno
(),
fcntl
.
F_SETFL
,
flags
)
try
:
read
=
_nb_clean
(
os
.
read
,
self
.
rfile
.
fileno
(),
LATENCY_BUFFER_SIZE
)
except
OSError
:
...
...
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