Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavrax committed Jun 26, 2024
1 parent 073c3a5 commit 9233cf9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
6 changes: 1 addition & 5 deletions core/pubnub_generate_uuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion freertos/pubnub_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
20 changes: 5 additions & 15 deletions mbedtls/pbpal_connect_mbedtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Expand All @@ -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);

Expand Down

0 comments on commit 9233cf9

Please sign in to comment.