mirror of
https://github.com/falk-werner/webfuse
synced 2024-10-27 20:34:10 +00:00
fixes eary trigger of is_connected (provider)
This commit is contained in:
parent
b35c78eab6
commit
5fa7e29b5c
@ -35,6 +35,15 @@ static void wfp_impl_client_protocol_process_request(
|
||||
json_t * request = json_loadb(message, length, 0, NULL);
|
||||
if (NULL != request)
|
||||
{
|
||||
// FIXME: is_connected should be invoked, when filesystem added
|
||||
if ((!protocol->is_connected) && (NULL != json_object_get(request, "result")))
|
||||
{
|
||||
protocol->is_connected = true;
|
||||
protocol->provider.connected(protocol->user_data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct wfp_impl_invokation_context context =
|
||||
{
|
||||
.provider = &protocol->provider,
|
||||
@ -84,8 +93,7 @@ static int wfp_impl_client_protocol_callback(
|
||||
{
|
||||
case LWS_CALLBACK_CLIENT_ESTABLISHED:
|
||||
wfp_impl_client_protocol_add_filesystem(protocol);
|
||||
protocol->is_connected = true;
|
||||
protocol->provider.connected(protocol->user_data);
|
||||
// Defer is_connected until response received
|
||||
break;
|
||||
case LWS_CALLBACK_CLIENT_CONNECTION_ERROR:
|
||||
protocol->is_connected = false;
|
||||
|
@ -22,12 +22,13 @@ public:
|
||||
|
||||
client = wfp_client_create(config);
|
||||
wfp_client_connect(client, url);
|
||||
while (!wfp_impl_client_is_connected(client))
|
||||
while (!wfp_impl_client_is_connected(client))
|
||||
{
|
||||
wfp_client_service(client, 100);
|
||||
}
|
||||
|
||||
thread = std::thread(Run, this);
|
||||
webfuse_test::msleep(200);
|
||||
}
|
||||
|
||||
~Private()
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include <jansson.h>
|
||||
#include "webfuse/core/lws_log.h"
|
||||
#include "msleep.hpp"
|
||||
#include "die_if.hpp"
|
||||
|
||||
using webfuse_test::Server;
|
||||
@ -69,7 +68,6 @@ TEST_F(IntegrationTest, HasMountpoint)
|
||||
|
||||
TEST_F(IntegrationTest, ProvidesTextFile)
|
||||
{
|
||||
webfuse_test::msleep(200);
|
||||
std::string file_name = std::string(GetBaseDir()) + "/cprovider/default/hello.txt";
|
||||
|
||||
ASSERT_EXIT({
|
||||
@ -87,7 +85,6 @@ TEST_F(IntegrationTest, ProvidesTextFile)
|
||||
|
||||
TEST_F(IntegrationTest, ReadTextFile)
|
||||
{
|
||||
webfuse_test::msleep(200);
|
||||
std::string file_name = std::string(GetBaseDir()) + "/cprovider/default/hello.txt";
|
||||
|
||||
ASSERT_EXIT({
|
||||
@ -108,8 +105,7 @@ TEST_F(IntegrationTest, ReadTextFile)
|
||||
}
|
||||
|
||||
TEST_F(IntegrationTest, ReadDir)
|
||||
{
|
||||
webfuse_test::msleep(200);
|
||||
{
|
||||
std::string dir_name = std::string(GetBaseDir()) + "/cprovider/default";
|
||||
|
||||
ASSERT_EXIT({
|
||||
|
Loading…
Reference in New Issue
Block a user