trunk/src/emu/webengine.c
| r30988 | r30989 | |
| 271 | 271 | // This handler is called for each incoming websocket frame, one or more |
| 272 | 272 | // times for connection lifetime. |
| 273 | 273 | // Echo websocket data back to the client. |
| 274 | | //const char *msg = "update_machine"; |
| 275 | | //mg_websocket_write(conn, 1, msg, strlen(msg)); |
| 276 | 274 | return conn->content_len == 4 && !memcmp(conn->content, "exit", 4) ? MG_FALSE : MG_TRUE; |
| 277 | 275 | } else { |
| 278 | 276 | web_engine *engine = static_cast<web_engine *>(conn->server_param); |
trunk/src/lib/web/mongoose.c
| r30988 | r30989 | |
| 548 | 548 | |
| 549 | 549 | if ((sock = socket(sa->sa.sa_family, SOCK_STREAM, 6)) != INVALID_SOCKET && |
| 550 | 550 | #ifndef _WIN32 |
| 551 | // SO_RESUSEADDR is not enabled on Windows because the semantics of |
| 552 | // SO_REUSEADDR on UNIX and Windows is different. On Windows, |
| 553 | // SO_REUSEADDR allows to bind a socket to a port without error even if |
| 554 | // the port is already open by another program. This is not the behavior |
| 555 | // SO_REUSEADDR was designed for, and leads to hard-to-track failure |
| 556 | // scenarios. Therefore, SO_REUSEADDR was disabled on Windows. |
| 551 | 557 | !setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *) &on, sizeof(on)) && |
| 552 | 558 | #endif |
| 553 | 559 | !bind(sock, &sa->sa, sa->sa.sa_family == AF_INET ? |
| r30988 | r30989 | |
| 4931 | 4937 | |
| 4932 | 4938 | case NS_POLL: |
| 4933 | 4939 | if (call_user(conn, MG_POLL) == MG_TRUE) { |
| 4934 | | nc->flags |= NSF_FINISHED_SENDING_DATA; |
| 4940 | if (conn->ns_conn->flags & MG_HEADERS_SENT) { |
| 4941 | write_terminating_chunk(conn); |
| 4942 | } |
| 4943 | close_local_endpoint(conn); |
| 4935 | 4944 | } |
| 4936 | 4945 | |
| 4937 | 4946 | if (conn != NULL && conn->endpoint_type == EP_FILE) { |