From 9233cf92e46ecc35310a3cfd8f45cf250057ae4a Mon Sep 17 00:00:00 2001 From: Xavrax Date: Wed, 26 Jun 2024 18:48:49 +0200 Subject: [PATCH] review fixes --- core/pubnub_generate_uuid.c | 6 +----- freertos/pubnub_config.h | 2 +- mbedtls/pbpal_connect_mbedtls.c | 20 +++++--------------- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/core/pubnub_generate_uuid.c b/core/pubnub_generate_uuid.c index 91f0abca..0290422b 100644 --- a/core/pubnub_generate_uuid.c +++ b/core/pubnub_generate_uuid.c @@ -46,12 +46,8 @@ int pubnub_generate_uuid_v1_time( ud->clock_seq_low = *io_clock_seq & 0xFF; ud->clock_seq_hi_and_reserved = (*io_clock_seq & 0x3F00) >> 8; ud->clock_seq_hi_and_reserved |= 0x80; -#ifdef ESP_PLATFORM - memcpy(ud->node, i_node, sizeof ud->node); -#else - memcpy(&ud->node, &i_node, sizeof ud->node); -#endif /* ESP_PLATFORM */ + memcpy(&ud->node, &i_node, sizeof ud->node); memcpy(s_timestamp, i_timestamp, sizeof s_timestamp); return 0; diff --git a/freertos/pubnub_config.h b/freertos/pubnub_config.h index e85527e3..ef5edc57 100644 --- a/freertos/pubnub_config.h +++ b/freertos/pubnub_config.h @@ -70,7 +70,7 @@ in milliseconds. Timeout duration in the context can be changed by the user after initialization. */ -#define PUBNUB_DEFAULT_TRANSACTION_TIMER 1024 +#define PUBNUB_DEFAULT_TRANSACTION_TIMER 310000 /** Mininmal duration of the transaction timer, in milliseconds. You * can't set less than this. diff --git a/mbedtls/pbpal_connect_mbedtls.c b/mbedtls/pbpal_connect_mbedtls.c index 3a303391..c9df3429 100644 --- a/mbedtls/pbpal_connect_mbedtls.c +++ b/mbedtls/pbpal_connect_mbedtls.c @@ -83,16 +83,6 @@ static char pubnub_cert_GlobalSign[] = static void alloc_setup(pubnub_t* pb); -static const char* get_origin(pubnub_t* pb) -{ -#ifdef PUBNUB_ORIGIN_SETTABLE - return pb->origin; -#else - PUBNUB_UNUSED(pb); - return PUBNUB_ORIGIN; -#endif -} - #define PUBNUB_PORT "443" enum pbpal_tls_result pbpal_start_tls(pubnub_t* pb) @@ -136,7 +126,7 @@ enum pbpal_tls_result pbpal_start_tls(pubnub_t* pb) } #endif - if (mbedtls_ssl_set_hostname(pal->ssl, get_origin(pb)) != 0) { + if (mbedtls_ssl_set_hostname(pal->ssl, PUBNUB_ORIGIN) != 0) { PUBNUB_LOG_ERROR("Failed to set hostname\n"); return pbtlsFailed; } @@ -162,13 +152,13 @@ enum pbpal_tls_result pbpal_start_tls(pubnub_t* pb) return pbtlsFailed; } - PUBNUB_LOG_DEBUG("Connecting to %s:%s...\n", get_origin(pb), PUBNUB_PORT); - if (0 != mbedtls_net_connect(pb->pal.net, get_origin(pb), PUBNUB_PORT, MBEDTLS_NET_PROTO_TCP)) { - PUBNUB_LOG_ERROR("Failed to connect to %s:%s\n", get_origin(pb), PUBNUB_PORT); + PUBNUB_LOG_DEBUG("Connecting to %s:%s...\n", PUBNUB_ORIGIN, PUBNUB_PORT); + if (0 != mbedtls_net_connect(pb->pal.net, PUBNUB_ORIGIN, PUBNUB_PORT, MBEDTLS_NET_PROTO_TCP)) { + PUBNUB_LOG_ERROR("Failed to connect to %s:%s\n", PUBNUB_ORIGIN, PUBNUB_PORT); return pbtlsFailed; } - PUBNUB_LOG_DEBUG("Connected to %s:%s\n", get_origin(pb), PUBNUB_PORT); + PUBNUB_LOG_DEBUG("Connected to %s:%s\n", PUBNUB_ORIGIN, PUBNUB_PORT); mbedtls_ssl_set_bio(pal->ssl, pb->pal.net, mbedtls_net_send, mbedtls_net_recv, NULL);