diff --git a/capi/libuwebsockets.cpp b/capi/libuwebsockets.cpp index a332e8e..80eba40 100644 --- a/capi/libuwebsockets.cpp +++ b/capi/libuwebsockets.cpp @@ -408,6 +408,20 @@ extern "C" uwsApp->domain(std::string(server_name, server_name_length)); } } + void uws_app_close(int ssl, uws_app_t *app) + { + if (ssl) + { + uWS::SSLApp *uwsApp = (uWS::SSLApp *)app; + uwsApp->close(); + } + else + { + uWS::App *uwsApp = (uWS::App *)app; + uwsApp->close(); + } + } + void uws_app_destroy(int ssl, uws_app_t *app) { if (ssl) diff --git a/capi/libuwebsockets.h b/capi/libuwebsockets.h index 784db8f..3c3cabb 100644 --- a/capi/libuwebsockets.h +++ b/capi/libuwebsockets.h @@ -1,16 +1,16 @@ /* * Copyright 2022 Ciro Spaciari - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -172,6 +172,7 @@ extern "C" DLL_EXPORT void uws_app_listen_domain(int ssl, uws_app_t *app, const char *domain, size_t domain_length, uws_listen_domain_handler handler, void *user_data); DLL_EXPORT void uws_app_listen_domain_with_options(int ssl, uws_app_t *app, const char *domain,size_t domain_length, int options, uws_listen_domain_handler handler, void *user_data); DLL_EXPORT void uws_app_domain(int ssl, uws_app_t *app, const char* server_name, size_t server_name_length); + DLL_EXPORT void uws_app_close(int ssl, uws_app_t *app); DLL_EXPORT bool uws_constructor_failed(int ssl, uws_app_t *app); DLL_EXPORT unsigned int uws_num_subscribers(int ssl, uws_app_t *app, const char *topic, size_t topic_length);