Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
noVNC
Project
Project
Details
Activity
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
noVNC
Commits
ec2b6140
Commit
ec2b6140
authored
Jan 31, 2011
by
Joel Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pull websockify: zombie reap, ignore unready clients.
parent
40f281eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
websocket.py
utils/websocket.py
+16
-4
websockify
utils/websockify
+4
-1
No files found.
utils/websocket.py
View file @
ec2b6140
...
@@ -213,7 +213,11 @@ Connection: Upgrade\r
...
@@ -213,7 +213,11 @@ Connection: Upgrade\r
stype
=
""
stype
=
""
# Peek, but don't read the data
ready
=
select
.
select
([
sock
],
[],
[],
3
)[
0
]
if
not
ready
:
raise
self
.
EClose
(
"ignoring socket not ready"
)
# Peek, but do not read the data so that we have a opportunity
# to SSL wrap the socket first
handshake
=
sock
.
recv
(
1024
,
socket
.
MSG_PEEK
)
handshake
=
sock
.
recv
(
1024
,
socket
.
MSG_PEEK
)
#self.msg("Handshake [%s]" % repr(handshake))
#self.msg("Handshake [%s]" % repr(handshake))
...
@@ -308,10 +312,18 @@ Connection: Upgrade\r
...
@@ -308,10 +312,18 @@ Connection: Upgrade\r
def
poll
(
self
):
def
poll
(
self
):
""" Run periodically while waiting for connections. """
""" Run periodically while waiting for connections. """
self
.
msg
(
"Running poll()"
)
#self.vmsg("Running poll()")
pass
def
top_SIGCHLD
(
self
,
sig
,
stack
):
# Reap zombies after calling child SIGCHLD handler
self
.
do_SIGCHLD
(
sig
,
stack
)
self
.
vmsg
(
"Got SIGCHLD, reaping zombies"
)
os
.
waitpid
(
-
1
,
os
.
WNOHANG
)
def
do_SIGCHLD
(
self
,
sig
,
stack
):
def
do_SIGCHLD
(
self
,
sig
,
stack
):
self
.
vmsg
(
"Got SIGCHLD, ignoring"
)
pass
def
do_SIGINT
(
self
,
sig
,
stack
):
def
do_SIGINT
(
self
,
sig
,
stack
):
self
.
msg
(
"Got SIGINT, exiting"
)
self
.
msg
(
"Got SIGINT, exiting"
)
...
@@ -340,7 +352,7 @@ Connection: Upgrade\r
...
@@ -340,7 +352,7 @@ Connection: Upgrade\r
self
.
started
()
# Some things need to happen after daemonizing
self
.
started
()
# Some things need to happen after daemonizing
# Reep zombies
# Reep zombies
signal
.
signal
(
signal
.
SIGCHLD
,
self
.
do
_SIGCHLD
)
signal
.
signal
(
signal
.
SIGCHLD
,
self
.
top
_SIGCHLD
)
signal
.
signal
(
signal
.
SIGINT
,
self
.
do_SIGINT
)
signal
.
signal
(
signal
.
SIGINT
,
self
.
do_SIGINT
)
while
True
:
while
True
:
...
...
utils/websockify
View file @
ec2b6140
...
@@ -160,7 +160,10 @@ Traffic Legend:
...
@@ -160,7 +160,10 @@ Traffic Legend:
try
:
try
:
self
.
do_proxy
(
client
,
tsock
)
self
.
do_proxy
(
client
,
tsock
)
except
:
except
:
if
tsock
:
tsock
.
close
()
if
tsock
:
tsock
.
close
()
self
.
vmsg
(
"
%
s:
%
s: Target closed"
%
(
self
.
target_host
,
self
.
target_port
))
if
self
.
rec
:
if
self
.
rec
:
self
.
rec
.
write
(
"'EOF']
\n
"
)
self
.
rec
.
write
(
"'EOF']
\n
"
)
self
.
rec
.
close
()
self
.
rec
.
close
()
...
...
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