444 |
444 |
445 void *my_ws_loop(void *threadid) |
445 void *my_ws_loop(void *threadid) |
446 { |
446 { |
447 struct lws_context_creation_info info; |
447 struct lws_context_creation_info info; |
448 int n = 0; |
448 int n = 0; |
|
449 pid_t pid = gettid(); |
449 |
450 |
450 my_ws_state = 1; |
451 my_ws_state = 1; |
451 memset(&info, 0, sizeof info); /* otherwise uninitialized garbage */ |
452 memset(&info, 0, sizeof info); /* otherwise uninitialized garbage */ |
452 info.port = Config.websocket_port; |
453 info.port = Config.websocket_port; |
453 info.protocols = protocols; |
454 info.protocols = protocols; |
461 if (context == NULL) { |
462 if (context == NULL) { |
462 syslog(LOG_NOTICE, "libwebsocket_create_context() failed"); |
463 syslog(LOG_NOTICE, "libwebsocket_create_context() failed"); |
463 my_ws_state = 0; |
464 my_ws_state = 0; |
464 return (void *)1; |
465 return (void *)1; |
465 } |
466 } |
466 syslog(LOG_NOTICE, "Websocket: server started port %d", info.port); |
467 syslog(LOG_NOTICE, "Websocket: server started port %d, pid=%d", info.port, pid); |
467 |
468 |
468 /* |
469 /* |
469 * Loop forever until external shutdown variable is set. |
470 * Loop forever until external shutdown variable is set. |
470 */ |
471 */ |
471 while (n >= 0 && ! my_ws_shutdown) { |
472 while (n >= 0 && ! my_ws_shutdown) { |