Commit c8e88e17 authored by Sergey Lyubka's avatar Sergey Lyubka

Sync fossa struct definitions

parent bf7a115b
...@@ -238,6 +238,7 @@ struct ns_connection { ...@@ -238,6 +238,7 @@ struct ns_connection {
sock_t sock; // Socket sock_t sock; // Socket
union socket_address sa; // Peer address union socket_address sa; // Peer address
size_t recv_iobuf_limit; /* Max size of recv buffer */
struct iobuf recv_iobuf; // Received data struct iobuf recv_iobuf; // Received data
struct iobuf send_iobuf; // Data scheduled for sending struct iobuf send_iobuf; // Data scheduled for sending
SSL *ssl; SSL *ssl;
...@@ -5270,31 +5271,32 @@ static void process_udp(struct ns_connection *nc) { ...@@ -5270,31 +5271,32 @@ static void process_udp(struct ns_connection *nc) {
//ns_printf(nc, "%s", "HTTP/1.0 200 OK\r\n\r\n"); //ns_printf(nc, "%s", "HTTP/1.0 200 OK\r\n\r\n");
} }
static void mg_ev_handler(struct ns_connection *nc, int ev, void *p) {
struct connection *conn = (struct connection *) nc->user_data;
// Send NS event to the handler. Note that call_user won't send an event
// if conn == NULL. Therefore, repeat this for NS_ACCEPT event as well.
#ifdef MONGOOSE_SEND_NS_EVENTS #ifdef MONGOOSE_SEND_NS_EVENTS
{ static void send_ns_event(struct ns_connection *nc, int ev, void *p) {
struct connection *conn = (struct connection *) nc->user_data; struct connection *conn = (struct connection *) nc->user_data;
if (conn != NULL) {
void *param[2] = { nc, p }; void *param[2] = { nc, p };
if (conn != NULL) conn->mg_conn.callback_param = param; conn->mg_conn.callback_param = param;
call_user(conn, (enum mg_event) ev); call_user(conn, (enum mg_event) ev);
} }
}
#else
static void send_ns_event(struct ns_connection *nc, int ev, void *p) {
(void) nc; (void) p;
}
#endif #endif
static void mg_ev_handler(struct ns_connection *nc, int ev, void *p) {
struct connection *conn = (struct connection *) nc->user_data;
// Send NS event to the handler. Note that call_user won't send an event
// if conn == NULL. Therefore, repeat this for NS_ACCEPT event as well.
send_ns_event(nc, ev, p);
switch (ev) { switch (ev) {
case NS_ACCEPT: case NS_ACCEPT:
on_accept(nc, (union socket_address *) p); on_accept(nc, (union socket_address *) p);
#ifdef MONGOOSE_SEND_NS_EVENTS send_ns_event(nc, ev, p);
{
struct connection *conn = (struct connection *) nc->user_data;
void *param[2] = { nc, p };
if (conn != NULL) conn->mg_conn.callback_param = param;
call_user(conn, (enum mg_event) ev);
}
#endif
break; break;
case NS_CONNECT: case NS_CONNECT:
...@@ -5366,9 +5368,9 @@ static void mg_ev_handler(struct ns_connection *nc, int ev, void *p) { ...@@ -5366,9 +5368,9 @@ static void mg_ev_handler(struct ns_connection *nc, int ev, void *p) {
write_terminating_chunk(conn); write_terminating_chunk(conn);
} }
close_local_endpoint(conn); close_local_endpoint(conn);
/* /*
* MG_POLL callback returned MG_TRUE, * MG_POLL callback returned MG_TRUE,
* i.e. data is sent, set corresponding flag * i.e. data is sent, set corresponding flag
*/ */
conn->ns_conn->flags |= NSF_FINISHED_SENDING_DATA; conn->ns_conn->flags |= NSF_FINISHED_SENDING_DATA;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment