mirror of
https://github.com/falk-werner/webfuse-provider
synced 2026-03-02 04:09:18 +00:00
removes shutdown method (#27)
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <webfuse_adapter.h>
|
||||
#include <userdb.h>
|
||||
|
||||
#define SERVICE_TIMEOUT (1 * 1000)
|
||||
|
||||
struct args
|
||||
{
|
||||
@@ -19,7 +20,7 @@ struct args
|
||||
bool show_help;
|
||||
};
|
||||
|
||||
static struct wf_server * server;
|
||||
static bool shutdown_requested = false;
|
||||
|
||||
static void show_help(void)
|
||||
{
|
||||
@@ -150,7 +151,7 @@ static void on_interrupt(int signal_id)
|
||||
{
|
||||
(void) signal_id;
|
||||
|
||||
wf_server_shutdown(server);
|
||||
shutdown_requested = true;
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
@@ -167,10 +168,14 @@ int main(int argc, char * argv[])
|
||||
if (!args.show_help)
|
||||
{
|
||||
signal(SIGINT, on_interrupt);
|
||||
server = wf_server_create(args.config);
|
||||
struct wf_server * server = wf_server_create(args.config);
|
||||
if (NULL != server)
|
||||
{
|
||||
wf_server_run(server);
|
||||
while (!shutdown_requested)
|
||||
{
|
||||
wf_server_service(server, SERVICE_TIMEOUT);
|
||||
}
|
||||
|
||||
wf_server_dispose(server);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
#include "webfuse_provider.h"
|
||||
|
||||
#define SERVICE_TIMEOUT (1 * 1000)
|
||||
|
||||
struct config
|
||||
{
|
||||
char * url;
|
||||
@@ -314,13 +316,12 @@ static void fs_read(
|
||||
}
|
||||
}
|
||||
|
||||
static struct wfp_client * client;
|
||||
static volatile bool shutdown_requested = false;
|
||||
|
||||
static void on_interrupt(int signal_id)
|
||||
{
|
||||
(void) signal_id;
|
||||
|
||||
wfp_client_shutdown(client);
|
||||
shutdown_requested = true;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
@@ -362,10 +363,13 @@ int main(int argc, char* argv[])
|
||||
wfp_client_config_set_onopen(config.client_config, &fs_open);
|
||||
wfp_client_config_set_onread(config.client_config, &fs_read);
|
||||
|
||||
client = wfp_client_create(config.client_config);
|
||||
struct wfp_client * client = wfp_client_create(config.client_config);
|
||||
wfp_client_connect(client, config.url);
|
||||
|
||||
wfp_client_run(client);
|
||||
while (!shutdown_requested)
|
||||
{
|
||||
wfp_client_service(client, SERVICE_TIMEOUT);
|
||||
}
|
||||
|
||||
wfp_client_dispose(client);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user