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
66937e39
Commit
66937e39
authored
Jan 13, 2011
by
Joel Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wsproxy.py: python2.4 fixes.
parent
c32e00c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
40 deletions
+42
-40
websocket.py
utils/websocket.py
+42
-40
No files found.
utils/websocket.py
View file @
66937e39
...
...
@@ -23,7 +23,7 @@ except:
from
urlparse
import
urlsplit
from
cgi
import
parse_qsl
class
WebSocketServer
():
class
WebSocketServer
(
object
):
"""
WebSockets server class.
Must be sub-classed with new_client method definition.
...
...
@@ -345,49 +345,51 @@ Connection: Upgrade\r
while
True
:
try
:
csock
=
startsock
=
None
pid
=
err
=
0
try
:
self
.
poll
()
ready
=
select
.
select
([
lsock
],
[],
[],
1
)[
0
];
if
lsock
in
ready
:
startsock
,
address
=
lsock
.
accept
()
csock
=
startsock
=
None
pid
=
err
=
0
try
:
self
.
poll
()
ready
=
select
.
select
([
lsock
],
[],
[],
1
)[
0
];
if
lsock
in
ready
:
startsock
,
address
=
lsock
.
accept
()
else
:
continue
except
Exception
,
exc
:
if
hasattr
(
exc
,
'errno'
):
err
=
exc
.
errno
else
:
err
=
exc
[
0
]
if
err
==
errno
.
EINTR
:
self
.
vmsg
(
"Ignoring interrupted syscall"
)
continue
else
:
raise
self
.
vmsg
(
'
%
s: forking handler'
%
address
[
0
])
pid
=
os
.
fork
()
if
pid
==
0
:
# handler process
csock
=
self
.
do_handshake
(
startsock
,
address
)
self
.
new_client
(
csock
)
else
:
continue
# parent process
self
.
handler_id
+=
1
except
self
.
EClose
,
exc
:
# Connection was not a WebSockets connection
if
exc
.
args
[
0
]:
self
.
msg
(
"
%
s:
%
s"
%
(
address
[
0
],
exc
.
args
[
0
]))
except
KeyboardInterrupt
,
exc
:
pass
except
Exception
,
exc
:
if
hasattr
(
exc
,
'errno'
):
err
=
exc
.
errno
elif
type
(
exc
)
==
select
.
error
:
err
=
exc
[
0
]
if
err
==
errno
.
EINTR
:
self
.
vmsg
(
"Ignoring interrupted syscall()"
)
continue
else
:
raise
self
.
msg
(
"handler exception:
%
s"
%
str
(
exc
))
if
self
.
verbose
:
self
.
msg
(
traceback
.
format_exc
())
self
.
vmsg
(
'
%
s: forking handler'
%
address
[
0
])
pid
=
os
.
fork
()
if
pid
==
0
:
# handler process
csock
=
self
.
do_handshake
(
startsock
,
address
)
self
.
new_client
(
csock
)
else
:
# parent process
self
.
handler_id
+=
1
except
self
.
EClose
,
exc
:
# Connection was not a WebSockets connection
if
exc
.
args
[
0
]:
self
.
msg
(
"
%
s:
%
s"
%
(
address
[
0
],
exc
.
args
[
0
]))
except
KeyboardInterrupt
,
exc
:
pass
except
Exception
,
exc
:
self
.
msg
(
"handler exception:
%
s"
%
str
(
exc
))
if
self
.
verbose
:
self
.
msg
(
traceback
.
format_exc
())
finally
:
if
csock
and
csock
!=
startsock
:
csock
.
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