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
4708cce8
Commit
4708cce8
authored
Dec 21, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mg_poll_server() returns currect time. add mg_set_listening_socket() and mg_get_listening_socket()
parent
3eb9156e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
mongoose.c
mongoose.c
+15
-2
mongoose.h
mongoose.h
+3
-1
No files found.
mongoose.c
View file @
4708cce8
...
...
@@ -3118,7 +3118,7 @@ void add_to_set(sock_t sock, fd_set *set, sock_t *max_fd) {
}
}
void
mg_poll_server
(
struct
mg_server
*
server
,
int
milliseconds
)
{
unsigned
int
mg_poll_server
(
struct
mg_server
*
server
,
int
milliseconds
)
{
struct
ll
*
lp
,
*
tmp
;
struct
connection
*
conn
;
struct
timeval
tv
;
...
...
@@ -3127,7 +3127,7 @@ void mg_poll_server(struct mg_server *server, int milliseconds) {
time_t
current_time
=
time
(
NULL
),
expire_time
=
current_time
-
atoi
(
server
->
config_options
[
IDLE_TIMEOUT_MS
])
/
1000
;
if
(
server
->
listening_sock
==
INVALID_SOCKET
)
return
;
if
(
server
->
listening_sock
==
INVALID_SOCKET
)
return
0
;
FD_ZERO
(
&
read_set
);
FD_ZERO
(
&
write_set
);
...
...
@@ -3193,6 +3193,8 @@ void mg_poll_server(struct mg_server *server, int milliseconds) {
close_conn
(
conn
);
}
}
return
(
unsigned
int
)
current_time
;
}
void
mg_destroy_server
(
struct
mg_server
**
server
)
{
...
...
@@ -3420,6 +3422,17 @@ const char *mg_set_option(struct mg_server *server, const char *name,
return
error_msg
;
}
void
mg_set_listening_socket
(
struct
mg_server
*
server
,
int
sock
)
{
if
(
server
->
listening_sock
!=
INVALID_SOCKET
)
{
closesocket
(
server
->
listening_sock
);
}
server
->
listening_sock
=
sock
;
}
int
mg_get_listening_socket
(
struct
mg_server
*
server
)
{
return
server
->
listening_sock
;
}
const
char
*
mg_get_option
(
const
struct
mg_server
*
server
,
const
char
*
name
)
{
const
char
**
opts
=
(
const
char
**
)
server
->
config_options
;
int
i
=
get_option_index
(
name
);
...
...
mongoose.h
View file @
4708cce8
...
...
@@ -62,11 +62,13 @@ typedef int (*mg_handler_t)(struct mg_connection *);
struct
mg_server
*
mg_create_server
(
void
*
server_param
);
void
mg_destroy_server
(
struct
mg_server
**
);
const
char
*
mg_set_option
(
struct
mg_server
*
,
const
char
*
opt
,
const
char
*
val
);
void
mg_poll_server
(
struct
mg_server
*
,
int
milliseconds
);
unsigned
int
mg_poll_server
(
struct
mg_server
*
,
int
milliseconds
);
void
mg_add_uri_handler
(
struct
mg_server
*
,
const
char
*
uri
,
mg_handler_t
);
void
mg_set_http_error_handler
(
struct
mg_server
*
,
mg_handler_t
);
const
char
**
mg_get_valid_option_names
(
void
);
const
char
*
mg_get_option
(
const
struct
mg_server
*
server
,
const
char
*
name
);
void
mg_set_listening_socket
(
struct
mg_server
*
,
int
sock
);
int
mg_get_listening_socket
(
struct
mg_server
*
);
int
mg_iterate_over_connections
(
struct
mg_server
*
,
void
(
*
func
)(
struct
mg_connection
*
,
void
*
),
void
*
param
);
...
...
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