diff --git a/tunnels/client/preconnect/preconnect_client.c b/tunnels/client/preconnect/preconnect_client.c index 0dc232ec..b8b2629d 100644 --- a/tunnels/client/preconnect/preconnect_client.c +++ b/tunnels/client/preconnect/preconnect_client.c @@ -13,11 +13,7 @@ static inline void upStream(tunnel_t *self, context_t *c) preconnect_client_con_state_t *cstate = CSTATE(c); switch (cstate->mode) { - LOGF("PreConnectClient: invalid behaviour from behind node (no init)"); - DISCARD_CONTEXT(c); - destroyContext(c); - break; - + case connected_direct: self->up->upStream(self->up, c); break; diff --git a/ww/buffer_stream.c b/ww/buffer_stream.c index 0bdf98c9..7b8070c4 100644 --- a/ww/buffer_stream.c +++ b/ww/buffer_stream.c @@ -1,15 +1,6 @@ #include "buffer_stream.h" -#define i_TYPE queue, shift_buffer_t * -#include "stc/deq.h" -#define Q_CAP 25 -struct buffer_stream_s -{ - buffer_pool_t *pool; - queue q; - size_t size; -}; #undef max #undef min diff --git a/ww/buffer_stream.h b/ww/buffer_stream.h index 735df0f2..aff24ef1 100644 --- a/ww/buffer_stream.h +++ b/ww/buffer_stream.h @@ -2,6 +2,17 @@ #include "buffer_pool.h" +#define i_TYPE queue, shift_buffer_t * +#include "stc/deq.h" +#define Q_CAP 25 + +struct buffer_stream_s +{ + buffer_pool_t *pool; + queue q; + size_t size; +}; + typedef struct buffer_stream_s buffer_stream_t; buffer_stream_t *newBufferStream(buffer_pool_t *pool); diff --git a/ww/utils/fileutils.h b/ww/utils/fileutils.h index f591807e..49b495b5 100644 --- a/ww/utils/fileutils.h +++ b/ww/utils/fileutils.h @@ -1,4 +1,4 @@ #pragma once char *readFile(const char *const path); -bool writeFile(const char *const path, char *data, size_t len); +bool writeFile(const char *const path,const char *data, size_t len); diff --git a/ww/utils/jsonutils.h b/ww/utils/jsonutils.h index 0be95836..0c460c96 100644 --- a/ww/utils/jsonutils.h +++ b/ww/utils/jsonutils.h @@ -1,17 +1,14 @@ #pragma once #include "cJSON.h" #include "basic_types.h" -#include "hv/hplatform.h" // for bool - +#include "hv/hplatform.h" // for bool // dest must be pre-allocated -bool getBoolFromJsonObject(bool *dest,const cJSON *json_obj, const char *key); -bool getIntFromJsonObject(int *dest,const cJSON *json_obj, const char *key); +bool getBoolFromJsonObject(bool *dest, const cJSON *json_obj, const char *key); +bool getIntFromJsonObject(int *dest, const cJSON *json_obj, const char *key); // will allocate dest because it knows the string-len -bool getStringFromJsonObject(char **dest,const cJSON *json_obj, const char *key); -bool getStringFromJsonObjectOrDefault(char **dest,const cJSON *json_obj, const char *key, const char *def); - - +bool getStringFromJsonObject(char **dest, const cJSON *json_obj, const char *key); +bool getStringFromJsonObjectOrDefault(char **dest, const cJSON *json_obj, const char *key, const char *def); -dynamic_value_t parseDynamicStrValueFromJsonObject(const cJSON *json_obj, char *key, size_t matchers, ...); -dynamic_value_t parseDynamicNumericValueFromJsonObject(const cJSON *json_obj, char *key, size_t matchers, ...); +dynamic_value_t parseDynamicStrValueFromJsonObject(const cJSON *json_obj, const char *key, size_t matchers, ...); +dynamic_value_t parseDynamicNumericValueFromJsonObject(const cJSON *json_obj, const char *key, size_t matchers, ...); diff --git a/ww/utils/utils.c b/ww/utils/utils.c index 6407666c..d63db3f7 100644 --- a/ww/utils/utils.c +++ b/ww/utils/utils.c @@ -36,7 +36,7 @@ char *readFile(const char *const path) return string; } -bool writeFile(const char *const path, char *data, size_t len) +bool writeFile(const char *const path,const char *data, size_t len) { FILE *f = fopen(path, "wb"); @@ -240,7 +240,7 @@ struct user_s *parseUserFromJsonObject(const cJSON *user_json) return user; } -dynamic_value_t parseDynamicStrValueFromJsonObject(const cJSON *json_obj, char *key, size_t matchers, ...) +dynamic_value_t parseDynamicStrValueFromJsonObject(const cJSON *json_obj,const char *key, size_t matchers, ...) { dynamic_value_t result = {0}; @@ -273,7 +273,7 @@ dynamic_value_t parseDynamicStrValueFromJsonObject(const cJSON *json_obj, char * } return result; } -dynamic_value_t parseDynamicNumericValueFromJsonObject(const cJSON *json_obj, char *key, size_t matchers, ...) +dynamic_value_t parseDynamicNumericValueFromJsonObject(const cJSON *json_obj,const char *key, size_t matchers, ...) { dynamic_value_t result = {0};