mirror of
https://github.com/holub/mame
synced 2025-10-07 17:27:06 +03:00
Update to latest (nw)
This commit is contained in:
parent
0cdb4bdb14
commit
dd8c59687f
@ -271,8 +271,6 @@ static int ev_handler(struct mg_connection *conn, enum mg_event ev) {
|
|||||||
// This handler is called for each incoming websocket frame, one or more
|
// This handler is called for each incoming websocket frame, one or more
|
||||||
// times for connection lifetime.
|
// times for connection lifetime.
|
||||||
// Echo websocket data back to the client.
|
// Echo websocket data back to the client.
|
||||||
//const char *msg = "update_machine";
|
|
||||||
//mg_websocket_write(conn, 1, msg, strlen(msg));
|
|
||||||
return conn->content_len == 4 && !memcmp(conn->content, "exit", 4) ? MG_FALSE : MG_TRUE;
|
return conn->content_len == 4 && !memcmp(conn->content, "exit", 4) ? MG_FALSE : MG_TRUE;
|
||||||
} else {
|
} else {
|
||||||
web_engine *engine = static_cast<web_engine *>(conn->server_param);
|
web_engine *engine = static_cast<web_engine *>(conn->server_param);
|
||||||
|
@ -548,6 +548,12 @@ static sock_t ns_open_listening_socket(union socket_address *sa) {
|
|||||||
|
|
||||||
if ((sock = socket(sa->sa.sa_family, SOCK_STREAM, 6)) != INVALID_SOCKET &&
|
if ((sock = socket(sa->sa.sa_family, SOCK_STREAM, 6)) != INVALID_SOCKET &&
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
// SO_RESUSEADDR is not enabled on Windows because the semantics of
|
||||||
|
// SO_REUSEADDR on UNIX and Windows is different. On Windows,
|
||||||
|
// SO_REUSEADDR allows to bind a socket to a port without error even if
|
||||||
|
// the port is already open by another program. This is not the behavior
|
||||||
|
// SO_REUSEADDR was designed for, and leads to hard-to-track failure
|
||||||
|
// scenarios. Therefore, SO_REUSEADDR was disabled on Windows.
|
||||||
!setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *) &on, sizeof(on)) &&
|
!setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *) &on, sizeof(on)) &&
|
||||||
#endif
|
#endif
|
||||||
!bind(sock, &sa->sa, sa->sa.sa_family == AF_INET ?
|
!bind(sock, &sa->sa, sa->sa.sa_family == AF_INET ?
|
||||||
@ -4931,7 +4937,10 @@ static void mg_ev_handler(struct ns_connection *nc, enum ns_event ev, void *p) {
|
|||||||
|
|
||||||
case NS_POLL:
|
case NS_POLL:
|
||||||
if (call_user(conn, MG_POLL) == MG_TRUE) {
|
if (call_user(conn, MG_POLL) == MG_TRUE) {
|
||||||
nc->flags |= NSF_FINISHED_SENDING_DATA;
|
if (conn->ns_conn->flags & MG_HEADERS_SENT) {
|
||||||
|
write_terminating_chunk(conn);
|
||||||
|
}
|
||||||
|
close_local_endpoint(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conn != NULL && conn->endpoint_type == EP_FILE) {
|
if (conn != NULL && conn->endpoint_type == EP_FILE) {
|
||||||
|
Loading…
Reference in New Issue
Block a user