mirror of
https://github.com/falk-werner/webfuse-provider
synced 2026-03-02 04:09:18 +00:00
made client protocol test single threaded
This commit is contained in:
@@ -38,7 +38,6 @@ static struct lws_context * wf_impl_server_context_create(
|
||||
memset(server->ws_protocols, 0, sizeof(struct lws_protocols) * WF_SERVER_PROTOCOL_COUNT);
|
||||
server->ws_protocols[0].name = "http";
|
||||
server->ws_protocols[0].callback = lws_callback_http_dummy;
|
||||
server->ws_protocols[1].name = "fs";
|
||||
wf_impl_server_protocol_init_lws(&server->protocol, &server->ws_protocols[1]);
|
||||
|
||||
memset(&server->mount, 0, sizeof(struct lws_http_mount));
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "webfuse/core/message.h"
|
||||
#include "webfuse/core/util.h"
|
||||
#include "webfuse/core/protocol_names.h"
|
||||
|
||||
#include "webfuse/adapter/impl/credentials.h"
|
||||
#include "webfuse/adapter/impl/jsonrpc/request.h"
|
||||
@@ -121,6 +122,7 @@ void wf_impl_server_protocol_init_lws(
|
||||
struct wf_server_protocol * protocol,
|
||||
struct lws_protocols * lws_protocol)
|
||||
{
|
||||
lws_protocol->name = WF_PROTOCOL_NAME_ADAPTER_SERVER;
|
||||
lws_protocol->callback = &wf_impl_server_protocol_callback;
|
||||
lws_protocol->per_session_data_size = 0;
|
||||
lws_protocol->user = protocol;
|
||||
|
||||
@@ -35,7 +35,6 @@ struct wfp_client * wfp_impl_client_create(
|
||||
wfp_impl_client_protocol_init(&client->protocol, &config->provider, config->user_data);
|
||||
|
||||
memset(client->protocols, 0, sizeof(struct lws_protocols) * WFP_CLIENT_PROTOCOL_COUNT);
|
||||
client->protocols[0].name = WFP_CLIENT_PROTOCOL_NAME;
|
||||
wfp_impl_client_protocol_init_lws(&client->protocol, &client->protocols[0]);
|
||||
|
||||
memset(&client->info, 0, sizeof(struct lws_context_creation_info));
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <libwebsockets.h>
|
||||
#include <jansson.h>
|
||||
|
||||
|
||||
#include "webfuse/provider/impl/client_config.h"
|
||||
#include "webfuse/provider/impl/provider.h"
|
||||
#include "webfuse/core/util.h"
|
||||
@@ -14,6 +13,7 @@
|
||||
#include "webfuse/core/message_queue.h"
|
||||
#include "webfuse/core/container_of.h"
|
||||
#include "webfuse/provider/impl/url.h"
|
||||
#include "webfuse/core/protocol_names.h"
|
||||
|
||||
static void wfp_impl_client_protocol_respond(
|
||||
json_t * response,
|
||||
@@ -112,7 +112,7 @@ static int wfp_impl_client_protocol_callback(
|
||||
// fall-through
|
||||
case LWS_CALLBACK_CLIENT_WRITEABLE:
|
||||
if ((wsi == protocol->wsi) && (!wf_slist_empty(&protocol->messages)))
|
||||
{
|
||||
{
|
||||
struct wf_slist_item * item = wf_slist_remove_first(&protocol->messages);
|
||||
struct wf_message * message = wf_container_of(item, struct wf_message, item);
|
||||
lws_write(wsi, (unsigned char*) message->data, message->length, LWS_WRITE_TEXT);
|
||||
@@ -180,6 +180,7 @@ void wfp_impl_client_protocol_init_lws(
|
||||
struct wfp_client_protocol * protocol,
|
||||
struct lws_protocols * lws_protocol)
|
||||
{
|
||||
lws_protocol->name = WF_PROTOCOL_NAME_PROVIDER_CLIENT;
|
||||
lws_protocol->callback = &wfp_impl_client_protocol_callback;
|
||||
lws_protocol->per_session_data_size = 0;
|
||||
lws_protocol->user = protocol;
|
||||
@@ -203,7 +204,8 @@ void wfp_impl_client_protocol_connect(
|
||||
info.host = info.address;
|
||||
info.origin = info.address;
|
||||
info.ssl_connection = (url_data.use_tls) ? LCCSCF_USE_SSL : 0;
|
||||
info.protocol = WFP_CLIENT_PROTOCOL_NAME;
|
||||
info.protocol = WF_PROTOCOL_NAME_ADAPTER_SERVER;
|
||||
info.local_protocol_name = WF_PROTOCOL_NAME_PROVIDER_CLIENT;
|
||||
info.pwsi = &protocol->wsi;
|
||||
|
||||
lws_client_connect_via_info(&info);
|
||||
|
||||
@@ -11,8 +11,6 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define WFP_CLIENT_PROTOCOL_NAME ("fs")
|
||||
|
||||
struct wfp_client_config;
|
||||
struct lws_protocols;
|
||||
struct lws_context;
|
||||
|
||||
Reference in New Issue
Block a user