mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
plugins: remove requirement for libuv on unix
This commit is contained in:
parent
c13ad5b648
commit
9e347e66ce
7 changed files with 74 additions and 19 deletions
|
@ -1194,6 +1194,7 @@ if (WIN32)
|
|||
lib/plat/windows/windows-init.c
|
||||
lib/plat/windows/windows-misc.c
|
||||
lib/plat/windows/windows-pipe.c
|
||||
lib/plat/windows/windows-plugins.c
|
||||
lib/plat/windows/windows-service.c
|
||||
lib/plat/windows/windows-sockets.c
|
||||
)
|
||||
|
|
|
@ -217,9 +217,8 @@ struct lws_plugin {
|
|||
struct lws_plugin *list; /**< linked list */
|
||||
#if (UV_VERSION_MAJOR > 0)
|
||||
uv_lib_t lib; /**< shared library pointer */
|
||||
#else
|
||||
void *l; /**< so we can compile on ancient libuv */
|
||||
#endif
|
||||
void *l; /**< so we can compile on ancient libuv */
|
||||
char name[64]; /**< name of the plugin */
|
||||
struct lws_plugin_capability caps; /**< plugin capabilities */
|
||||
};
|
||||
|
|
|
@ -323,8 +323,8 @@ lws_libuv_check_watcher_active(struct lws *wsi)
|
|||
|
||||
#if defined(LWS_WITH_PLUGINS) && (UV_VERSION_MAJOR > 0)
|
||||
|
||||
LWS_VISIBLE int
|
||||
lws_plat_plugins_init(struct lws_context *context, const char * const *d)
|
||||
int
|
||||
lws_uv_plugins_init(struct lws_context *context, const char * const *d)
|
||||
{
|
||||
struct lws_plugin_capability lcaps;
|
||||
struct lws_plugin *plugin;
|
||||
|
@ -425,8 +425,8 @@ bail:
|
|||
return ret;
|
||||
}
|
||||
|
||||
LWS_VISIBLE int
|
||||
lws_plat_plugins_destroy(struct lws_context *context)
|
||||
int
|
||||
lws_uv_plugins_destroy(struct lws_context *context)
|
||||
{
|
||||
struct lws_plugin *plugin = context->plugin_list, *p;
|
||||
lws_plugin_destroy_func func;
|
||||
|
@ -435,8 +435,6 @@ lws_plat_plugins_destroy(struct lws_context *context)
|
|||
void *v;
|
||||
int m;
|
||||
|
||||
// return 0;
|
||||
|
||||
#if defined(__MINGW32__) || !defined(WIN32)
|
||||
pofs = 3;
|
||||
#endif
|
||||
|
|
|
@ -67,5 +67,11 @@ struct lws_signal_watcher_libuv {
|
|||
|
||||
extern struct lws_event_loop_ops event_loop_ops_uv;
|
||||
|
||||
LWS_VISIBLE uv_loop_t *
|
||||
uv_loop_t *
|
||||
lws_uv_getloop(struct lws_context *context, int tsi);
|
||||
|
||||
int
|
||||
lws_uv_plugins_init(struct lws_context *context, const char * const *d);
|
||||
|
||||
int
|
||||
lws_uv_plugins_destroy(struct lws_context *context);
|
||||
|
|
|
@ -57,8 +57,8 @@ lws_plat_init(struct lws_context *context,
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifdef LWS_WITH_PLUGINS
|
||||
if (info->plugin_dirs && (context->options & LWS_SERVER_OPTION_LIBUV))
|
||||
#if defined(LWS_WITH_PLUGINS)
|
||||
if (info->plugin_dirs)
|
||||
lws_plat_plugins_init(context, info->plugin_dirs);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -30,13 +30,6 @@
|
|||
#endif
|
||||
#include <dirent.h>
|
||||
|
||||
/*
|
||||
* this is a dummy implementation to keep travis happy. The real, working
|
||||
* implementation can be found in event-libs/libuv/libuv.c
|
||||
*/
|
||||
|
||||
#if UV_VERSION_MAJOR <= 0
|
||||
|
||||
static int filter(const struct dirent *ent)
|
||||
{
|
||||
if (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."))
|
||||
|
@ -56,6 +49,11 @@ lws_plat_plugins_init(struct lws_context * context, const char * const *d)
|
|||
char path[256];
|
||||
void *l;
|
||||
|
||||
#if defined(LWS_WITH_PLUGINS) && (UV_VERSION_MAJOR > 0)
|
||||
if (lws_check_opt(context->options, LWS_SERVER_OPTION_LIBUV))
|
||||
return lws_uv_plugins_init(context, d);
|
||||
#endif
|
||||
|
||||
lwsl_notice(" Plugins:\n");
|
||||
|
||||
while (d && *d) {
|
||||
|
@ -125,6 +123,8 @@ lws_plat_plugins_init(struct lws_context * context, const char * const *d)
|
|||
d++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
bail:
|
||||
free(namelist);
|
||||
|
||||
|
@ -139,6 +139,11 @@ lws_plat_plugins_destroy(struct lws_context * context)
|
|||
char path[256];
|
||||
int m;
|
||||
|
||||
#if defined(LWS_WITH_PLUGINS) && (UV_VERSION_MAJOR > 0)
|
||||
if (lws_check_opt(context->options, LWS_SERVER_OPTION_LIBUV))
|
||||
return lws_uv_plugins_destroy(context);
|
||||
#endif
|
||||
|
||||
if (!plugin)
|
||||
return 0;
|
||||
|
||||
|
@ -170,4 +175,3 @@ next:
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
47
lib/plat/windows/windows-plugins.c
Normal file
47
lib/plat/windows/windows-plugins.c
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* libwebsockets - small server side websockets and web server implementation
|
||||
*
|
||||
* Copyright (C) 2010 - 2019 Andy Green <andy@warmcat.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation:
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#include "core/private.h"
|
||||
|
||||
int
|
||||
lws_plat_plugins_init(struct lws_context * context, const char * const *d)
|
||||
{
|
||||
#if defined(LWS_WITH_PLUGINS) && (UV_VERSION_MAJOR > 0)
|
||||
if (lws_check_opt(context->options, LWS_SERVER_OPTION_LIBUV))
|
||||
return lws_uv_plugins_init(context, d);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
lws_plat_plugins_destroy(struct lws_context * context)
|
||||
{
|
||||
#if defined(LWS_WITH_PLUGINS) && (UV_VERSION_MAJOR > 0)
|
||||
if (lws_check_opt(context->options, LWS_SERVER_OPTION_LIBUV))
|
||||
return lws_uv_plugins_destroy(context);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue