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
edc47252
Commit
edc47252
authored
14 years ago
by
Joel Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
proxy: do handshake in forked process too.
parent
a0315ab1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
websocket.c
utils/websocket.c
+11
-6
websocket.py
utils/websocket.py
+7
-2
No files found.
utils/websocket.c
View file @
edc47252
...
...
@@ -504,12 +504,6 @@ void start_server() {
}
handler_msg
(
"got client connection from %s
\n
"
,
inet_ntoa
(
cli_addr
.
sin_addr
));
ws_ctx
=
do_handshake
(
csock
);
if
(
ws_ctx
==
NULL
)
{
close
(
csock
);
continue
;
}
/* base64 is 4 bytes for every 3
* 20 for WS '\x00' / '\xff' and good measure */
dbufsize
=
(
bufsize
*
3
)
/
4
-
20
;
...
...
@@ -520,6 +514,17 @@ void start_server() {
}
if
(
pid
==
0
)
{
// handler process
ws_ctx
=
do_handshake
(
csock
);
if
(
ws_ctx
==
NULL
)
{
close
(
csock
);
if
(
settings
.
multiprocess
)
{
handler_msg
(
"No connection after handshake"
);
break
;
// Child process exits
}
else
{
continue
;
}
}
settings
.
handler
(
ws_ctx
);
if
(
pipe_error
)
{
handler_emsg
(
"Closing due to SIGPIPE
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
utils/websocket.py
View file @
edc47252
...
...
@@ -208,14 +208,19 @@ def start_server():
settings
[
'listen_host'
],
settings
[
'listen_port'
])
startsock
,
address
=
lsock
.
accept
()
handler_msg
(
'got client connection from
%
s'
%
address
[
0
])
csock
=
do_handshake
(
startsock
)
if
not
csock
:
continue
if
settings
[
'multiprocess'
]:
handler_msg
(
"forking handler process"
)
pid
=
os
.
fork
()
if
pid
==
0
:
# handler process
csock
=
do_handshake
(
startsock
)
if
not
csock
:
if
settings
[
'multiprocess'
]:
handler_msg
(
"No connection after handshake"
);
break
else
:
continue
settings
[
'handler'
](
csock
)
else
:
# parent process
settings
[
'handler_id'
]
+=
1
...
...
This diff is collapsed.
Click to expand it.
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