context deprecation
[platform/upstream/libwebsockets.git] / lib / server.c
index 2c8cf7d..45f691b 100644 (file)
@@ -152,8 +152,6 @@ lws_context_init_server(struct lws_context_creation_info *info,
        wsi->vhost = vhost;
        wsi->listener = 1;
 
-       vhost->context->pt[m].wsi_listening = wsi;
-
 #ifdef LWS_USE_LIBUV
        if (LWS_LIBUV_ENABLED(vhost->context))
                lws_uv_initvhost(vhost, wsi);
@@ -192,27 +190,6 @@ bail:
        return 1;
 }
 
-int
-_lws_server_listen_accept_flow_control(struct lws *twsi, int on)
-{
-       struct lws_context_per_thread *pt = &twsi->context->pt[(int)twsi->tsi];
-       struct lws *wsi = pt->wsi_listening;
-       int n;
-
-       if (!wsi || twsi->context->being_destroyed)
-               return 0;
-
-       lwsl_debug("%s: Thr %d: LISTEN wsi %p: state %d\n",
-                  __func__, twsi->tsi, (void *)wsi, on);
-
-       if (on)
-               n = lws_change_pollfd(wsi, 0, LWS_POLLIN);
-       else
-               n = lws_change_pollfd(wsi, LWS_POLLIN, 0);
-
-       return n;
-}
-
 #if defined(LWS_WITH_ESP8266)
 #undef strchr
 #define strchr ets_strchr
@@ -1208,6 +1185,8 @@ lws_handshake_server(struct lws *wsi, unsigned char **buf, size_t len)
                                                        msg++;
                                                lws_return_http_status(wsi, atoi(rej->value), msg);
 
+                                               wsi->vhost->conn_stats.rejected++;
+
                                                goto bail_nuke_ah;
                                        }
                                        rej = rej->next;
@@ -1227,9 +1206,9 @@ lws_handshake_server(struct lws *wsi, unsigned char **buf, size_t len)
                } else
                        lwsl_info("no host\n");
 
-               wsi->vhost->trans++;
+               wsi->vhost->conn_stats.trans++;
                if (!wsi->conn_stat_done) {
-                       wsi->vhost->conn++;
+                       wsi->vhost->conn_stats.conn++;
                        wsi->conn_stat_done = 1;
                }
 
@@ -1241,14 +1220,14 @@ lws_handshake_server(struct lws *wsi, unsigned char **buf, size_t len)
                if (lws_hdr_total_length(wsi, WSI_TOKEN_UPGRADE)) {
                        if (!strcasecmp(lws_hdr_simple_ptr(wsi, WSI_TOKEN_UPGRADE),
                                        "websocket")) {
-                               wsi->vhost->ws_upgrades++;
+                               wsi->vhost->conn_stats.ws_upg++;
                                lwsl_info("Upgrade to ws\n");
                                goto upgrade_ws;
                        }
 #ifdef LWS_USE_HTTP2
                        if (!strcasecmp(lws_hdr_simple_ptr(wsi, WSI_TOKEN_UPGRADE),
                                        "h2c")) {
-                               wsi->vhost->http2_upgrades++;
+                               wsi->vhost->conn_stats.http2_upg++;
                                lwsl_info("Upgrade to h2c\n");
                                goto upgrade_h2c;
                        }
@@ -1591,7 +1570,8 @@ lws_create_new_server_wsi(struct lws_vhost *vhost)
        }
 
        new_wsi->tsi = n;
-       lwsl_info("Accepted %p to tsi %d\n", new_wsi, new_wsi->tsi);
+       lwsl_notice("Accepted wsi %p to context %p, tsi %d\n", new_wsi,
+                   vhost->context, new_wsi->tsi);
 
        new_wsi->vhost = vhost;
        new_wsi->context = vhost->context;