trunk/src/emu/webengine.c
| r24862 | r24863 | |
| 132 | 132 | static void websocket_ready_handler_static(struct mg_connection *conn) |
| 133 | 133 | { |
| 134 | 134 | const struct mg_request_info *request_info = mg_get_request_info(conn); |
| 135 | | web_engine *engine = downcast<web_engine *>(request_info->user_data); |
| 135 | web_engine *engine = static_cast<web_engine *>(request_info->user_data); |
| 136 | 136 | engine->websocket_ready_handler(conn); |
| 137 | 137 | } |
| 138 | 138 | |
| r24862 | r24863 | |
| 140 | 140 | char *data, size_t data_len) |
| 141 | 141 | { |
| 142 | 142 | const struct mg_request_info *request_info = mg_get_request_info(conn); |
| 143 | | web_engine *engine = downcast<web_engine *>(request_info->user_data); |
| 143 | web_engine *engine = static_cast<web_engine *>(request_info->user_data); |
| 144 | 144 | return engine->websocket_data_handler(conn, flags, data, data_len); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | static int begin_request_handler_static(struct mg_connection *conn) |
| 148 | 148 | { |
| 149 | 149 | const struct mg_request_info *request_info = mg_get_request_info(conn); |
| 150 | | web_engine *engine = downcast<web_engine *>(request_info->user_data); |
| 150 | web_engine *engine = static_cast<web_engine *>(request_info->user_data); |
| 151 | 151 | return engine->begin_request_handler(conn); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | static void *websocket_keepalive_static(void *thread_func_param) |
| 155 | 155 | { |
| 156 | | web_engine *engine = downcast<web_engine *>(thread_func_param); |
| 156 | web_engine *engine = static_cast<web_engine *>(thread_func_param); |
| 157 | 157 | return engine->websocket_keepalive(); |
| 158 | 158 | } |
| 159 | 159 | |
| r24862 | r24863 | |
| 225 | 225 | { |
| 226 | 226 | for (simple_list_wrapper<mg_connection> *curitem = m_websockets.first(); curitem != NULL; curitem = curitem->next()) |
| 227 | 227 | { |
| 228 | | mg_websocket_write(curitem->object(), WEBSOCKET_OPCODE_TEXT, message, strlen(message)); |
| 228 | int status = mg_websocket_write(curitem->object(), WEBSOCKET_OPCODE_TEXT, message, strlen(message)); |
| 229 | if (status==0) m_websockets.remove(*curitem); // remove inactive clients |
| 229 | 230 | } |
| 230 | 231 | } |