Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
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
esp
mongoose
Commits
40e5c744
Commit
40e5c744
authored
Jan 17, 2014
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Calling long-running URI handlers on each poll iteration
parent
e648681f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
mongoose.c
mongoose.c
+9
-6
No files found.
mongoose.c
View file @
40e5c744
...
@@ -318,7 +318,8 @@ enum connection_flags {
...
@@ -318,7 +318,8 @@ enum connection_flags {
CONN_HEADERS_SENT
=
8
,
// User callback has sent HTTP headers
CONN_HEADERS_SENT
=
8
,
// User callback has sent HTTP headers
CONN_BUFFER
=
16
,
// CGI only. Holds data send until CGI prints
CONN_BUFFER
=
16
,
// CGI only. Holds data send until CGI prints
// all HTTP headers
// all HTTP headers
CONN_CONNECTED
=
32
// HTTP client has connected
CONN_CONNECTED
=
32
,
// HTTP client has connected
CONN_LONG_RUNNING
=
64
// Long-running URI handlers
};
};
struct
connection
{
struct
connection
{
...
@@ -1917,6 +1918,8 @@ static void call_uri_handler(struct connection *conn) {
...
@@ -1917,6 +1918,8 @@ static void call_uri_handler(struct connection *conn) {
write_terminating_chunk
(
conn
);
write_terminating_chunk
(
conn
);
}
}
close_local_endpoint
(
conn
);
close_local_endpoint
(
conn
);
}
else
{
conn
->
flags
|=
CONN_LONG_RUNNING
;
}
}
}
}
...
@@ -1940,11 +1943,6 @@ static void write_to_client(struct connection *conn) {
...
@@ -1940,11 +1943,6 @@ static void write_to_client(struct connection *conn) {
conn
->
num_bytes_sent
+=
n
;
conn
->
num_bytes_sent
+=
n
;
}
}
if
(
conn
->
endpoint_type
==
EP_USER
&&
!
conn
->
mg_conn
.
is_websocket
)
{
conn
->
mg_conn
.
wsbits
=
conn
->
flags
&
CONN_CLOSE
?
1
:
0
;
call_uri_handler
(
conn
);
}
if
(
io
->
len
==
0
&&
conn
->
flags
&
CONN_SPOOL_DONE
)
{
if
(
io
->
len
==
0
&&
conn
->
flags
&
CONN_SPOOL_DONE
)
{
conn
->
flags
|=
CONN_CLOSE
;
conn
->
flags
|=
CONN_CLOSE
;
}
}
...
@@ -3741,6 +3739,11 @@ unsigned int mg_poll_server(struct mg_server *server, int milliseconds) {
...
@@ -3741,6 +3739,11 @@ unsigned int mg_poll_server(struct mg_server *server, int milliseconds) {
conn
->
last_activity_time
=
current_time
;
conn
->
last_activity_time
=
current_time
;
write_to_client
(
conn
);
write_to_client
(
conn
);
}
}
if
(
conn
->
flags
&
CONN_LONG_RUNNING
)
{
conn
->
mg_conn
.
wsbits
=
conn
->
flags
&
CONN_CLOSE
?
1
:
0
;
call_uri_handler
(
conn
);
}
}
}
}
}
...
...
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