Sync fossa struct definitions

This commit is contained in:
Sergey Lyubka 2015-05-15 17:20:54 +01:00
parent bf7a115bf2
commit c8e88e1710

View File

@ -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) {
//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");
} }
#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;
if (conn != NULL) {
void *param[2] = { nc, p };
conn->mg_conn.callback_param = param;
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
static void mg_ev_handler(struct ns_connection *nc, int ev, void *p) { static void mg_ev_handler(struct ns_connection *nc, int ev, void *p) {
struct connection *conn = (struct connection *) nc->user_data; struct connection *conn = (struct connection *) nc->user_data;
// Send NS event to the handler. Note that call_user won't send an event // 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. // if conn == NULL. Therefore, repeat this for NS_ACCEPT event as well.
#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
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: