mirror of
https://github.com/falk-werner/webfuse-provider
synced 2024-10-27 20:44:10 +00:00
fixes static filesystem example (#31)
This commit is contained in:
parent
09df34debc
commit
a8a7ad28c1
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
#include "webfuse_provider.h"
|
#include "webfuse_provider.h"
|
||||||
|
|
||||||
|
#define SERVICE_TIMEOUT (1 * 1000)
|
||||||
|
|
||||||
struct args
|
struct args
|
||||||
{
|
{
|
||||||
char const * url;
|
char const * url;
|
||||||
@ -41,13 +43,12 @@ parse_args(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wfp_client * client = NULL;
|
static volatile bool shutdown_requested = false;
|
||||||
|
|
||||||
static void on_interrupt(int signal_id)
|
static void on_interrupt(int signal_id)
|
||||||
{
|
{
|
||||||
(void) signal_id;
|
(void) signal_id;
|
||||||
|
shutdown_requested = true;
|
||||||
wfp_client_shutdown(client);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_usage()
|
static void print_usage()
|
||||||
@ -81,9 +82,13 @@ int main(int argc, char* argv[])
|
|||||||
struct wfp_static_filesystem * fs = wfp_static_filesystem_create(config);
|
struct wfp_static_filesystem * fs = wfp_static_filesystem_create(config);
|
||||||
wfp_static_filesystem_add_text(fs, "hello.txt", 0444, "Hello, World!");
|
wfp_static_filesystem_add_text(fs, "hello.txt", 0444, "Hello, World!");
|
||||||
|
|
||||||
client = wfp_client_create(config);
|
struct wfp_client * client = wfp_client_create(config);
|
||||||
wfp_client_connect(client, args.url);
|
wfp_client_connect(client, args.url);
|
||||||
wfp_client_run(client);
|
|
||||||
|
while (!shutdown_requested)
|
||||||
|
{
|
||||||
|
wfp_client_service(client, SERVICE_TIMEOUT);
|
||||||
|
}
|
||||||
|
|
||||||
wfp_client_dispose(client);
|
wfp_client_dispose(client);
|
||||||
wfp_static_filesystem_dispose(fs);
|
wfp_static_filesystem_dispose(fs);
|
||||||
|
Loading…
Reference in New Issue
Block a user