diff options
author | Andrey Uzunov <andrey.uzunov@gmail.com> | 2013-07-05 15:15:55 +0000 |
---|---|---|
committer | Andrey Uzunov <andrey.uzunov@gmail.com> | 2013-07-05 15:15:55 +0000 |
commit | 70a7c61f74fc6dfa75d5a57b7599dee5e13be749 (patch) | |
tree | e9d0262a76980413baa98d0d1ef4c1757678db02 /src/microspdy | |
parent | 3b9e9c85b8dab59b73039c5bade324e07504da72 (diff) | |
download | libmicrohttpd-70a7c61f74fc6dfa75d5a57b7599dee5e13be749.tar.gz libmicrohttpd-70a7c61f74fc6dfa75d5a57b7599dee5e13be749.zip |
spdy: init library changed
Diffstat (limited to 'src/microspdy')
-rw-r--r-- | src/microspdy/applicationlayer.c | 24 | ||||
-rw-r--r-- | src/microspdy/daemon.h | 6 |
2 files changed, 28 insertions, 2 deletions
diff --git a/src/microspdy/applicationlayer.c b/src/microspdy/applicationlayer.c index 8bf9c67e..d2676785 100644 --- a/src/microspdy/applicationlayer.c +++ b/src/microspdy/applicationlayer.c | |||
@@ -233,13 +233,24 @@ spdy_handler_response_queue_result(void * cls, | |||
233 | 233 | ||
234 | 234 | ||
235 | int | 235 | int |
236 | SPDY_init () | 236 | (SPDY_init) (enum SPDY_IO_SUBSYSTEM io_subsystem, ...) |
237 | { | 237 | { |
238 | SPDYF_ASSERT(SPDYF_BUFFER_SIZE >= SPDY_MAX_SUPPORTED_FRAME_SIZE, | 238 | SPDYF_ASSERT(SPDYF_BUFFER_SIZE >= SPDY_MAX_SUPPORTED_FRAME_SIZE, |
239 | "Buffer size is less than max supported frame size!"); | 239 | "Buffer size is less than max supported frame size!"); |
240 | SPDYF_ASSERT(SPDY_MAX_SUPPORTED_FRAME_SIZE >= 32, | 240 | SPDYF_ASSERT(SPDY_MAX_SUPPORTED_FRAME_SIZE >= 32, |
241 | "Max supported frame size must be bigger than the minimal value!"); | 241 | "Max supported frame size must be bigger than the minimal value!"); |
242 | SPDYF_openssl_global_init(); | 242 | SPDYF_ASSERT(SPDY_IO_SUBSYSTEM_NONE == spdyf_io_initialized, |
243 | "SPDY_init must be called only once per program or after SPDY_deinit"); | ||
244 | |||
245 | if(SPDY_IO_SUBSYSTEM_OPENSSL & io_subsystem) | ||
246 | { | ||
247 | SPDYF_openssl_global_init(); | ||
248 | spdyf_io_initialized |= SPDY_IO_SUBSYSTEM_OPENSSL; | ||
249 | } | ||
250 | |||
251 | SPDYF_ASSERT(SPDY_IO_SUBSYSTEM_NONE != spdyf_io_initialized, | ||
252 | "SPDY_init could not find even one IO subsystem"); | ||
253 | |||
243 | return SPDY_YES; | 254 | return SPDY_YES; |
244 | } | 255 | } |
245 | 256 | ||
@@ -247,9 +258,13 @@ SPDY_init () | |||
247 | void | 258 | void |
248 | SPDY_deinit () | 259 | SPDY_deinit () |
249 | { | 260 | { |
261 | SPDYF_ASSERT(SPDY_IO_SUBSYSTEM_NONE != spdyf_io_initialized, | ||
262 | "SPDY_init has not been called!"); | ||
263 | |||
250 | //currently nothing to be freed/deinited | 264 | //currently nothing to be freed/deinited |
251 | //SPDYF_openssl_global_deinit doesn't do anything now | 265 | //SPDYF_openssl_global_deinit doesn't do anything now |
252 | //SPDYF_openssl_global_deinit(); | 266 | //SPDYF_openssl_global_deinit(); |
267 | spdyf_io_initialized = SPDY_IO_SUBSYSTEM_NONE; | ||
253 | } | 268 | } |
254 | 269 | ||
255 | 270 | ||
@@ -317,6 +332,11 @@ SPDY_start_daemon (uint16_t port, | |||
317 | struct SPDY_Daemon *daemon; | 332 | struct SPDY_Daemon *daemon; |
318 | va_list valist; | 333 | va_list valist; |
319 | 334 | ||
335 | if(SPDY_IO_SUBSYSTEM_NONE == spdyf_io_initialized) | ||
336 | { | ||
337 | SPDYF_DEBUG("library not initialized"); | ||
338 | return NULL; | ||
339 | } | ||
320 | if(NULL == certfile) | 340 | if(NULL == certfile) |
321 | { | 341 | { |
322 | SPDYF_DEBUG("certfile is NULL"); | 342 | SPDYF_DEBUG("certfile is NULL"); |
diff --git a/src/microspdy/daemon.h b/src/microspdy/daemon.h index d3f7f2ff..791c32e1 100644 --- a/src/microspdy/daemon.h +++ b/src/microspdy/daemon.h | |||
@@ -29,6 +29,12 @@ | |||
29 | 29 | ||
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Global flags containing the initialized IO subsystems. | ||
33 | */ | ||
34 | enum SPDY_IO_SUBSYSTEM spdyf_io_initialized; | ||
35 | |||
36 | |||
37 | /** | ||
32 | * Start a SPDDY webserver on the given port. | 38 | * Start a SPDDY webserver on the given port. |
33 | * | 39 | * |
34 | * @param port port to bind to | 40 | * @param port port to bind to |