diff --git a/CMakeLists.txt b/CMakeLists.txt index 039a6a7e2..06df8ffdb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -264,7 +264,6 @@ option(LWS_WITH_LEJP_CONF "With LEJP configuration parser as used by lwsws" OFF) option(LWS_WITH_ZLIB "Include zlib support (required for extensions)" OFF) option(LWS_WITH_BUNDLED_ZLIB "Use bundled zlib version (Windows only)" ${LWS_WITH_BUNDLED_ZLIB_DEFAULT}) option(LWS_WITH_MINIZ "Use miniz instead of zlib" OFF) -option(LWS_WITH_DEPRECATED_THINGS "Temporary workaround for deprecated apis" OFF) option(LWS_WITH_SEQUENCER "lws_seq_t support" OFF) option(LWS_WITH_EXTERNAL_POLL "Support external POLL integration using callback messages (not recommended)" OFF) option(LWS_WITH_LWS_DSH "Support lws_dsh_t Disordered Shared Heap" OFF) diff --git a/include/libwebsockets/lws-timeout-timer.h b/include/libwebsockets/lws-timeout-timer.h index 6fd6a0e97..102a25fcd 100644 --- a/include/libwebsockets/lws-timeout-timer.h +++ b/include/libwebsockets/lws-timeout-timer.h @@ -150,64 +150,6 @@ lws_set_timeout_us(struct lws *wsi, enum pending_timeout reason, lws_usec_t us); LWS_VISIBLE LWS_EXTERN void lws_set_timer_usecs(struct lws *wsi, lws_usec_t usecs); -#if defined(LWS_WITH_DEPRECATED_THINGS) - -/* - * lws_timed_callback_vh_protocol() - calls back a protocol on a vhost after - * the specified delay in seconds - * - * \param vh: the vhost to call back - * \param protocol: the protocol to call back - * \param reason: callback reason - * \param secs: how many seconds in the future to do the callback. - * - * DEPRECATED since v4.1 - * - * Callback the specified protocol with a fake wsi pointing to the specified - * vhost and protocol, with the specified reason, at the specified time in the - * future. - * - * Returns 0 if OK or 1 on OOM. - * - * In the multithreaded service case, the callback will occur in the same - * service thread context as the call to this api that requested it. If it is - * called from a non-service thread, tsi 0 will handle it. - */ -LWS_VISIBLE LWS_EXTERN int -lws_timed_callback_vh_protocol(struct lws_vhost *vh, - const struct lws_protocols *prot, - int reason, int secs) -LWS_WARN_DEPRECATED; - -/* - * lws_timed_callback_vh_protocol_us() - calls back a protocol on a vhost after - * the specified delay in us - * - * \param vh: the vhost to call back - * \param protocol: the protocol to call back - * \param reason: callback reason - * \param us: how many us in the future to do the callback. - * - * DEPRECATED since v4.1 - * - * Callback the specified protocol with a fake wsi pointing to the specified - * vhost and protocol, with the specified reason, at the specified time in the - * future. - * - * Returns 0 if OK or 1 on OOM. - * - * In the multithreaded service case, the callback will occur in the same - * service thread context as the call to this api that requested it. If it is - * called from a non-service thread, tsi 0 will handle it. - */ -LWS_VISIBLE LWS_EXTERN int -lws_timed_callback_vh_protocol_us(struct lws_vhost *vh, - const struct lws_protocols *prot, int reason, - lws_usec_t us) -LWS_WARN_DEPRECATED; - -#endif - struct lws_sorted_usec_list; typedef void (*sul_cb_t)(struct lws_sorted_usec_list *sul); diff --git a/lib/core-net/private-lib-core-net.h b/lib/core-net/private-lib-core-net.h index a3b667d0f..fae9fc948 100644 --- a/lib/core-net/private-lib-core-net.h +++ b/lib/core-net/private-lib-core-net.h @@ -241,19 +241,6 @@ struct client_info_stash { lws_usec_t __lws_sul_service_ripe(lws_dll2_owner_t *own, int num_own, lws_usec_t usnow); -#if defined(LWS_WITH_DEPRECATED_THINGS) - -struct lws_timed_vh_protocol { - struct lws_timed_vh_protocol *next; - lws_sorted_usec_list_t sul; - const struct lws_protocols *protocol; - struct lws_vhost *vhost; /* only used for pending processing */ - int reason; - int tsi_req; -}; - -#endif - /* * lws_async_dns */ @@ -508,9 +495,6 @@ struct lws_vhost { struct lws_vhost_tls tls; #endif -#if defined(LWS_WITH_DEPRECATED_THINGS) - struct lws_timed_vh_protocol *timed_vh_protocol_list; -#endif void *user; int listen_port; @@ -1213,11 +1197,6 @@ lws_destroy_event_pipe(struct lws *wsi); int lws_socks5c_generate_msg(struct lws *wsi, enum socks_msg_type type, ssize_t *msg_len); -#if defined(LWS_WITH_DEPRECATED_THINGS) -int -__lws_timed_callback_remove(struct lws_vhost *vh, struct lws_timed_vh_protocol *p); -#endif - int LWS_WARN_UNUSED_RESULT __insert_wsi_socket_into_fds(struct lws_context *context, struct lws *wsi); diff --git a/lib/core-net/vhost.c b/lib/core-net/vhost.c index 8fa3d08bd..515008366 100644 --- a/lib/core-net/vhost.c +++ b/lib/core-net/vhost.c @@ -1425,14 +1425,6 @@ __lws_vhost_destroy2(struct lws_vhost *vh) // lwsl_info("%s: %s\n", __func__, vh->name); -#if defined(LWS_WITH_DEPRECATED_THINGS) - /* - * destroy any pending timed events - */ - - while (vh->timed_vh_protocol_list) - __lws_timed_callback_remove(vh, vh->timed_vh_protocol_list); -#endif /* * let the protocols destroy the per-vhost protocol objects */ diff --git a/lib/core-net/wsi-timeout.c b/lib/core-net/wsi-timeout.c index e7c3ed879..d041947fc 100644 --- a/lib/core-net/wsi-timeout.c +++ b/lib/core-net/wsi-timeout.c @@ -195,92 +195,6 @@ lws_set_timeout_us(struct lws *wsi, enum pending_timeout reason, lws_usec_t us) lws_pt_unlock(pt); } -#if defined(LWS_WITH_DEPRECATED_THINGS) - -/* requires context + vh lock */ - -int -__lws_timed_callback_remove(struct lws_vhost *vh, struct lws_timed_vh_protocol *p) -{ - lws_start_foreach_llp_safe(struct lws_timed_vh_protocol **, pt, - vh->timed_vh_protocol_list, next) { - if (*pt == p) { - *pt = p->next; - lws_dll2_remove(&p->sul.list); - lws_free(p); - - return 0; - } - } lws_end_foreach_llp_safe(pt); - - return 1; -} - -void -lws_sul_timed_callback_vh_protocol_cb(lws_sorted_usec_list_t *sul) -{ - struct lws_timed_vh_protocol *tvp = lws_container_of(sul, - struct lws_timed_vh_protocol, sul); - lws_fakewsi_def_plwsa(&tvp->vhost->context->pt[0]); - - lws_fakewsi_prep_plwsa_ctx(tvp->vhost->context); - plwsa->vhost = tvp->vhost; /* not a real bound wsi */ - plwsa->protocol = tvp->protocol; - - tvp->protocol->callback((struct lws *)plwsa, tvp->reason, NULL, NULL, 0); - - __lws_timed_callback_remove(tvp->vhost, tvp); -} - -int -lws_timed_callback_vh_protocol_us(struct lws_vhost *vh, - const struct lws_protocols *prot, int reason, - lws_usec_t us) -{ - struct lws_timed_vh_protocol *p = (struct lws_timed_vh_protocol *) - lws_malloc(sizeof(*p), "timed_vh"); - - if (!p) - return 1; - - memset(p, 0, sizeof(*p)); - - p->tsi_req = lws_pthread_self_to_tsi(vh->context); - if (p->tsi_req < 0) /* not called from a service thread --> tsi 0 */ - p->tsi_req = 0; - - lws_context_lock(vh->context, __func__); /* context ----------------- */ - - p->protocol = prot; - p->reason = reason; - p->vhost = vh; - - p->sul.cb = lws_sul_timed_callback_vh_protocol_cb; - /* list is always at the very top of the sul */ - __lws_sul_insert(&vh->context->pt[p->tsi_req].pt_sul_owner, - (lws_sorted_usec_list_t *)&p->sul.list, us); - - lws_vhost_lock(vh); /* vhost ---------------------------------------- */ - p->next = vh->timed_vh_protocol_list; - vh->timed_vh_protocol_list = p; - lws_vhost_unlock(vh); /* -------------------------------------- vhost */ - - lws_context_unlock(vh->context); /* ------------------------- context */ - - return 0; -} - -int -lws_timed_callback_vh_protocol(struct lws_vhost *vh, - const struct lws_protocols *prot, int reason, - int secs) -{ - return lws_timed_callback_vh_protocol_us(vh, prot, reason, - ((lws_usec_t)secs) * LWS_US_PER_SEC); -} - -#endif - static void lws_validity_cb(lws_sorted_usec_list_t *sul) {