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
0e640ae8
Commit
0e640ae8
authored
May 13, 2014
by
Daniel O'Connell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made setopt() wrapper around mg_set_option()
parent
1bff6df2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
proxy.c
examples/proxy.c
+14
-6
No files found.
examples/proxy.c
View file @
0e640ae8
...
...
@@ -94,6 +94,13 @@ static void show_usage_and_exit(const char *prog) {
exit
(
EXIT_FAILURE
);
}
static
void
setopt
(
struct
mg_server
*
s
,
const
char
*
opt
,
const
char
*
val
)
{
const
char
*
err_msg
=
mg_set_option
(
s
,
opt
,
val
);
if
(
err_msg
!=
NULL
)
{
elog
(
1
,
"Error setting [%s]: [%s]"
,
opt
,
err_msg
);
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
i
;
...
...
@@ -117,17 +124,18 @@ int main(int argc, char *argv[]) {
// Create, configure and start proxy server in a separate thread
s_proxy_server
=
mg_create_server
(
NULL
,
&
sse_handler
);
mg_set_option
(
s_proxy_server
,
"listening_port"
,
s_proxy_port
);
mg_set_option
(
s_proxy_server
,
"ssl_certificate"
,
s_cert
);
mg_set_option
(
s_proxy_server
,
"ssl_ca_certificate"
,
s_ca_cert
);
setopt
(
s_proxy_server
,
"listening_port"
,
s_proxy_port
);
setopt
(
s_proxy_server
,
"ssl_certificate"
,
s_cert
);
setopt
(
s_proxy_server
,
"ssl_ca_certificate"
,
s_ca_cert
);
setopt
(
s_proxy_server
,
"hexdump_file"
,
"/dev/stdout"
);
mg_start_thread
(
serve_thread_func
,
s_proxy_server
);
// Create, configure and start SSE server and SSE pusher threads
// Start two SSE pushing threads
// Serve SSE server in the main thread
s_sse_server
=
mg_create_server
(
NULL
,
&
sse_handler
);
mg_set_option
(
s_sse_server
,
"listening_port"
,
s_sse_port
);
mg_set_option
(
s_sse_server
,
"document_root"
,
"."
);
setopt
(
s_sse_server
,
"listening_port"
,
s_sse_port
);
setopt
(
s_sse_server
,
"document_root"
,
"."
);
mg_start_thread
(
sse_pusher_thread_func
,
(
void
*
)
"sse_pusher_thread_1"
);
mg_start_thread
(
sse_pusher_thread_func
,
(
void
*
)
"sse_pusher_thread_2"
);
serve_thread_func
(
s_sse_server
);
...
...
@@ -137,4 +145,4 @@ int main(int argc, char *argv[]) {
mg_destroy_server
(
&
s_proxy_server
);
return
EXIT_SUCCESS
;
}
\ No newline at end of file
}
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