mirror of
https://github.com/outbackdingo/parodus.git
synced 2026-01-28 10:20:04 +00:00
Compare commits
19 Commits
main
...
webcfg_bin
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c02b141f7c | ||
|
|
2a184e24c9 | ||
|
|
233a167cb4 | ||
|
|
49513df8f8 | ||
|
|
d0e6c5bd75 | ||
|
|
66f1f4d4fb | ||
|
|
19b4f56913 | ||
|
|
c30d5a3362 | ||
|
|
c98e2e2fb8 | ||
|
|
c78625f35a | ||
|
|
aeea6fbb03 | ||
|
|
d2d1590329 | ||
|
|
e693c09ca3 | ||
|
|
0b9f739323 | ||
|
|
d901efd10c | ||
|
|
824bcb81cf | ||
|
|
671fc5be59 | ||
|
|
4bf8683192 | ||
|
|
9300d76a8e |
17
.github/workflows/push.yml
vendored
17
.github/workflows/push.yml
vendored
@@ -4,7 +4,7 @@
|
|||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request_target:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'AUTHORS'
|
- 'AUTHORS'
|
||||||
@@ -24,7 +24,7 @@ jobs:
|
|||||||
runs-on: [ ubuntu-latest ]
|
runs-on: [ ubuntu-latest ]
|
||||||
steps:
|
steps:
|
||||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
@@ -38,8 +38,10 @@ jobs:
|
|||||||
- name: Make Build Directory
|
- name: Make Build Directory
|
||||||
run: mkdir build
|
run: mkdir build
|
||||||
|
|
||||||
- name: Install sonar-scanner and build-wrapper
|
- name: Get Sonarcloud Binaries
|
||||||
uses: sonarsource/sonarcloud-github-c-cpp@v2
|
working-directory: build
|
||||||
|
run: |
|
||||||
|
../.github/scripts/get_sonarcloud.sh
|
||||||
|
|
||||||
- name: CMake
|
- name: CMake
|
||||||
working-directory: build
|
working-directory: build
|
||||||
@@ -50,7 +52,7 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
working-directory: build
|
working-directory: build
|
||||||
run: |
|
run: |
|
||||||
build-wrapper-linux-x86-64 --out-dir bw-output make all test
|
build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw-output make all test
|
||||||
|
|
||||||
- name: Merge GCOV Reports for Sonarcloud
|
- name: Merge GCOV Reports for Sonarcloud
|
||||||
working-directory: build
|
working-directory: build
|
||||||
@@ -64,8 +66,7 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Upload Codecov.io
|
- name: Upload Codecov.io
|
||||||
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
|
uses: codecov/codecov-action@v1
|
||||||
with:
|
with:
|
||||||
directory: .
|
directory: .
|
||||||
flags: unittests
|
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
13
CHANGELOG.md
13
CHANGELOG.md
@@ -5,12 +5,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|||||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
## [v1.1.5]
|
|
||||||
- Add additional HTTP headers for call to Themis from Convey
|
- Add additional HTTP headers for call to Themis from Convey
|
||||||
- Change default branch name to `main`
|
- Add callback handler for initial cloud connection status change event
|
||||||
|
- Fix Parodus connection stuck on interface up down received together
|
||||||
|
- Update to use nopoll version 1.0.3
|
||||||
|
|
||||||
## [v1.1.4]
|
## [1.1.4]
|
||||||
- on connect retry, requery jwt only if it failed before
|
- on connect retry, requery jwt only if it failed before
|
||||||
- put two timestamps in connection health file; start conn and current
|
- put two timestamps in connection health file; start conn and current
|
||||||
- change health file update interval to 240sec
|
- change health file update interval to 240sec
|
||||||
@@ -105,9 +105,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
### Added
|
### Added
|
||||||
- Initial creation
|
- Initial creation
|
||||||
|
|
||||||
[Unreleased]: https://github.com/Comcast/parodus/compare/v1.1.5...HEAD
|
[Unreleased]: https://github.com/Comcast/parodus/compare/1.1.4...HEAD
|
||||||
[1.1.5]: https://github.com/Comcast/parodus/compare/v1.1.4...v1.1.5
|
[1.1.4]: https://github.com/Comcast/parodus/compare/1.1.3...1.1.4
|
||||||
[1.1.4]: https://github.com/Comcast/parodus/compare/1.1.3...v1.1.4
|
|
||||||
[1.1.3]: https://github.com/Comcast/parodus/compare/1.1.2...1.1.3
|
[1.1.3]: https://github.com/Comcast/parodus/compare/1.1.2...1.1.3
|
||||||
[1.1.2]: https://github.com/Comcast/parodus/compare/1.1.1...1.1.2
|
[1.1.2]: https://github.com/Comcast/parodus/compare/1.1.1...1.1.2
|
||||||
[1.1.1]: https://github.com/Comcast/parodus/compare/1.0.4...1.1.1
|
[1.1.1]: https://github.com/Comcast/parodus/compare/1.0.4...1.1.1
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 2.8.7)
|
cmake_minimum_required(VERSION 2.8.7)
|
||||||
|
|
||||||
#project(parodus VERSION 1.1.5)
|
#project(parodus VERSION 1.1.15)
|
||||||
project(parodus)
|
project(parodus)
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
@@ -86,7 +86,7 @@ add_dependencies(libtrower-base64 trower-base64)
|
|||||||
ExternalProject_Add(nopoll
|
ExternalProject_Add(nopoll
|
||||||
PREFIX ${PREFIX_DIR}/nopoll
|
PREFIX ${PREFIX_DIR}/nopoll
|
||||||
GIT_REPOSITORY https://github.com/Comcast/nopoll.git
|
GIT_REPOSITORY https://github.com/Comcast/nopoll.git
|
||||||
GIT_TAG "1.0.2"
|
GIT_TAG "1.0.3"
|
||||||
CONFIGURE_COMMAND COMMAND <SOURCE_DIR>/autogen.sh --prefix=${PREFIX}
|
CONFIGURE_COMMAND COMMAND <SOURCE_DIR>/autogen.sh --prefix=${PREFIX}
|
||||||
--includedir=${INCLUDE_DIR}
|
--includedir=${INCLUDE_DIR}
|
||||||
--libdir=${LIBRARY_DIR}
|
--libdir=${LIBRARY_DIR}
|
||||||
@@ -253,6 +253,10 @@ if (FEATURE_DNS_QUERY)
|
|||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFEATURE_DNS_QUERY ")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFEATURE_DNS_QUERY ")
|
||||||
endif (FEATURE_DNS_QUERY)
|
endif (FEATURE_DNS_QUERY)
|
||||||
|
|
||||||
|
if (ENABLE_WEBCFGBIN)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_WEBCFGBIN ")
|
||||||
|
endif (ENABLE_WEBCFGBIN)
|
||||||
|
|
||||||
link_directories ( ${LIBRARY_DIR} ${COMMON_LIBRARY_DIR} ${LIBRARY_DIR64} )
|
link_directories ( ${LIBRARY_DIR} ${COMMON_LIBRARY_DIR} ${LIBRARY_DIR64} )
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
if (BUILD_TESTING)
|
if (BUILD_TESTING)
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ else()
|
|||||||
set(SOURCES ${SOURCES} seshat_interface_stub.c)
|
set(SOURCES ${SOURCES} seshat_interface_stub.c)
|
||||||
endif (ENABLE_SESHAT)
|
endif (ENABLE_SESHAT)
|
||||||
|
|
||||||
|
if (ENABLE_WEBCFGBIN)
|
||||||
|
set(SOURCES ${SOURCES} upstream_rbus.c)
|
||||||
|
endif (ENABLE_WEBCFGBIN)
|
||||||
|
|
||||||
add_executable(parodus ${SOURCES})
|
add_executable(parodus ${SOURCES})
|
||||||
|
|
||||||
|
|||||||
@@ -112,6 +112,9 @@ void createSocketConnection(void (* initKeypress)())
|
|||||||
UpStreamMsgQ = NULL;
|
UpStreamMsgQ = NULL;
|
||||||
StartThread(handle_upstream, &upstream_tid);
|
StartThread(handle_upstream, &upstream_tid);
|
||||||
StartThread(processUpstreamMessage, &upstream_msg_tid);
|
StartThread(processUpstreamMessage, &upstream_msg_tid);
|
||||||
|
#ifdef ENABLE_WEBCFGBIN
|
||||||
|
subscribeRBUSevent();
|
||||||
|
#endif
|
||||||
ParodusMsgQ = NULL;
|
ParodusMsgQ = NULL;
|
||||||
StartThread(messageHandlerTask, &downstream_tid);
|
StartThread(messageHandlerTask, &downstream_tid);
|
||||||
StartThread(serviceAliveTask, &svc_alive_tid);
|
StartThread(serviceAliveTask, &svc_alive_tid);
|
||||||
@@ -195,7 +198,8 @@ void createSocketConnection(void (* initKeypress)())
|
|||||||
}
|
}
|
||||||
createNopollConnection(ctx, &server_list);
|
createNopollConnection(ctx, &server_list);
|
||||||
}
|
}
|
||||||
} while(!get_close_retry() && !g_shutdown);
|
//process exit only when g_shutdown is true.
|
||||||
|
} while(FOREVER() && !g_shutdown);
|
||||||
|
|
||||||
pthread_mutex_lock (get_global_svc_mut());
|
pthread_mutex_lock (get_global_svc_mut());
|
||||||
pthread_cond_signal (get_global_svc_con());
|
pthread_cond_signal (get_global_svc_con());
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ enum {
|
|||||||
/* File Scoped Variables */
|
/* File Scoped Variables */
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
parodusOnConnStatusChangeHandler on_conn_status_change;
|
||||||
|
|
||||||
parodusOnPingStatusChangeHandler on_ping_status_change;
|
parodusOnPingStatusChangeHandler on_ping_status_change;
|
||||||
|
|
||||||
pthread_mutex_t backoff_delay_mut=PTHREAD_MUTEX_INITIALIZER;
|
pthread_mutex_t backoff_delay_mut=PTHREAD_MUTEX_INITIALIZER;
|
||||||
@@ -697,7 +699,8 @@ int wait_while_interface_down()
|
|||||||
if (rtn != 0)
|
if (rtn != 0)
|
||||||
ParodusError
|
ParodusError
|
||||||
("Error on pthread_cond_wait (%d) in wait_while_interface_down\n", rtn);
|
("Error on pthread_cond_wait (%d) in wait_while_interface_down\n", rtn);
|
||||||
if ((rtn != 0) || g_shutdown) {
|
if (g_shutdown) {
|
||||||
|
ParodusInfo("Received g_shutdown during interface down wait, returning\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -717,6 +720,7 @@ int createNopollConnection(noPollCtx *ctx, server_list_t *server_list)
|
|||||||
struct timespec connect_time,*connectTimePtr;
|
struct timespec connect_time,*connectTimePtr;
|
||||||
connectTimePtr = &connect_time;
|
connectTimePtr = &connect_time;
|
||||||
backoff_timer_t backoff_timer;
|
backoff_timer_t backoff_timer;
|
||||||
|
static int init_conn_failure=1;
|
||||||
|
|
||||||
if(ctx == NULL) {
|
if(ctx == NULL) {
|
||||||
return nopoll_false;
|
return nopoll_false;
|
||||||
@@ -752,6 +756,14 @@ int createNopollConnection(noPollCtx *ctx, server_list_t *server_list)
|
|||||||
}
|
}
|
||||||
/* if we failed to connect, don't reuse the redirect server */
|
/* if we failed to connect, don't reuse the redirect server */
|
||||||
free_server (&conn_ctx.server_list->redirect);
|
free_server (&conn_ctx.server_list->redirect);
|
||||||
|
|
||||||
|
/* On initial connect failure, invoke conn status change event as "failed" only 1 time*/
|
||||||
|
if((NULL != on_conn_status_change) && init && init_conn_failure)
|
||||||
|
{
|
||||||
|
on_conn_status_change("failed");
|
||||||
|
init_conn_failure=0;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef FEATURE_DNS_QUERY
|
#ifdef FEATURE_DNS_QUERY
|
||||||
/* if we don't already have a valid jwt, look up server information */
|
/* if we don't already have a valid jwt, look up server information */
|
||||||
if (server_is_null (&conn_ctx.server_list->jwt))
|
if (server_is_null (&conn_ctx.server_list->jwt))
|
||||||
@@ -776,6 +788,12 @@ int createNopollConnection(noPollCtx *ctx, server_list_t *server_list)
|
|||||||
get_parodus_cfg()->cloud_status = CLOUD_STATUS_ONLINE;
|
get_parodus_cfg()->cloud_status = CLOUD_STATUS_ONLINE;
|
||||||
ParodusInfo("cloud_status set as %s after successful connection\n", get_parodus_cfg()->cloud_status);
|
ParodusInfo("cloud_status set as %s after successful connection\n", get_parodus_cfg()->cloud_status);
|
||||||
|
|
||||||
|
/* On initial connect success, invoke conn status change event as "success" */
|
||||||
|
if((NULL != on_conn_status_change) && init)
|
||||||
|
{
|
||||||
|
on_conn_status_change("success");
|
||||||
|
}
|
||||||
|
|
||||||
// Invoke the ping status change event callback as "received" ping
|
// Invoke the ping status change event callback as "received" ping
|
||||||
if(NULL != on_ping_status_change)
|
if(NULL != on_ping_status_change)
|
||||||
{
|
{
|
||||||
@@ -934,3 +952,8 @@ void registerParodusOnPingStatusChangeHandler(parodusOnPingStatusChangeHandler c
|
|||||||
on_ping_status_change = callback_func;
|
on_ping_status_change = callback_func;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void registerParodusOnConnStatusChangeHandler(parodusOnConnStatusChangeHandler callback_func)
|
||||||
|
{
|
||||||
|
on_conn_status_change = callback_func;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,15 @@ extern "C" {
|
|||||||
#define SHUTDOWN_REASON_SYSTEM_RESTART "system_restarting"
|
#define SHUTDOWN_REASON_SYSTEM_RESTART "system_restarting"
|
||||||
#define SHUTDOWN_REASON_SIGTERM "SIGTERM"
|
#define SHUTDOWN_REASON_SIGTERM "SIGTERM"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* parodusOnConnStatusChangeHandler - Function pointer
|
||||||
|
* Used to define callback function to do additional processing
|
||||||
|
* when websocket cloud connection status change event
|
||||||
|
* i.e. "cloud-conn-status" as "fail" or "success"
|
||||||
|
*/
|
||||||
|
typedef void (*parodusOnConnStatusChangeHandler) (char * status);
|
||||||
|
extern parodusOnConnStatusChangeHandler on_conn_status_change;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* parodusOnPingStatusChangeHandler - Function pointer
|
* parodusOnPingStatusChangeHandler - Function pointer
|
||||||
* Used to define callback function to do additional processing
|
* Used to define callback function to do additional processing
|
||||||
@@ -79,6 +88,9 @@ void set_cloud_disconnect_time(int disconnTime);
|
|||||||
void start_conn_in_progress (unsigned long start_time);
|
void start_conn_in_progress (unsigned long start_time);
|
||||||
void stop_conn_in_progress (void);
|
void stop_conn_in_progress (void);
|
||||||
|
|
||||||
|
// To Register parodusOnConnStatusChangeHandler Callback function
|
||||||
|
void registerParodusOnConnStatusChangeHandler(parodusOnConnStatusChangeHandler on_conn_status_change);
|
||||||
|
|
||||||
// To Register parodusOnPingStatusChangeHandler Callback function
|
// To Register parodusOnPingStatusChangeHandler Callback function
|
||||||
void registerParodusOnPingStatusChangeHandler(parodusOnPingStatusChangeHandler on_ping_status_change);
|
void registerParodusOnPingStatusChangeHandler(parodusOnPingStatusChangeHandler on_ping_status_change);
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ typedef struct UpStreamMsg__
|
|||||||
void packMetaData();
|
void packMetaData();
|
||||||
void *handle_upstream();
|
void *handle_upstream();
|
||||||
void *processUpstreamMessage();
|
void *processUpstreamMessage();
|
||||||
|
void registerRBUSlistener();
|
||||||
int getDeviceId(char **device_id, size_t *device_id_len);
|
int getDeviceId(char **device_id, size_t *device_id_len);
|
||||||
void sendUpstreamMsgToServer(void **resp_bytes, size_t resp_size);
|
void sendUpstreamMsgToServer(void **resp_bytes, size_t resp_size);
|
||||||
void getServiceNameAndSendResponse(wrp_msg_t *msg, void **msg_bytes, size_t msg_size);
|
void getServiceNameAndSendResponse(wrp_msg_t *msg, void **msg_bytes, size_t msg_size);
|
||||||
|
|||||||
123
src/upstream_rbus.c
Normal file
123
src/upstream_rbus.c
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2021 Comcast Cable Communications Management, LLC
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @file upstream_rbus.c
|
||||||
|
*
|
||||||
|
* @description This is used for parodus-RBUS communication
|
||||||
|
* to send notification events upstream to cloud.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <rbus.h>
|
||||||
|
#include "upstream.h"
|
||||||
|
#include "ParodusInternal.h"
|
||||||
|
#include "partners_check.h"
|
||||||
|
|
||||||
|
#define WEBCFG_UPSTREAM_EVENT "Webconfig.Upstream"
|
||||||
|
|
||||||
|
void processWebconfigUpstreamEvent(rbusHandle_t handle, rbusEvent_t const* event, rbusEventSubscription_t* subscription);
|
||||||
|
|
||||||
|
void subscribeAsyncHandler( rbusHandle_t handle, rbusEventSubscription_t* subscription, rbusError_t error);
|
||||||
|
|
||||||
|
/* API to register RBUS listener to receive messages from webconfig */
|
||||||
|
void subscribeRBUSevent()
|
||||||
|
{
|
||||||
|
rbusError_t err;
|
||||||
|
int rc = RBUS_ERROR_SUCCESS;
|
||||||
|
rbusHandle_t rbus_Handle;
|
||||||
|
|
||||||
|
err = rbus_open(&rbus_Handle, "parodus");
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
ParodusError("rbus_open failed :%s\n", rbusError_ToString(err));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
rc = rbusEvent_SubscribeAsync(rbus_Handle,WEBCFG_UPSTREAM_EVENT,processWebconfigUpstreamEvent,subscribeAsyncHandler,"parodus",10*60);
|
||||||
|
if(rc != RBUS_ERROR_SUCCESS)
|
||||||
|
ParodusError("rbusEvent_Subscribe failed: %d, %s\n", rc, rbusError_ToString(rc));
|
||||||
|
else
|
||||||
|
ParodusInfo("rbusEvent_Subscribe was successful\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void processWebconfigUpstreamEvent(rbusHandle_t handle, rbusEvent_t const* event, rbusEventSubscription_t* subscription)
|
||||||
|
{
|
||||||
|
(void)handle;
|
||||||
|
(void)subscription;
|
||||||
|
|
||||||
|
int rv=-1;
|
||||||
|
wrp_msg_t *event_msg;
|
||||||
|
void *bytes;
|
||||||
|
int len;
|
||||||
|
rbusValue_t value = NULL;
|
||||||
|
|
||||||
|
value = rbusObject_GetValue(event->data, "value");
|
||||||
|
bytes = rbusValue_GetBytes(value, &len);
|
||||||
|
|
||||||
|
rv = wrp_to_struct( bytes, len, WRP_BYTES, &event_msg );
|
||||||
|
if(rv > 0)
|
||||||
|
{
|
||||||
|
ParodusInfo(" Received upstream event data: dest '%s'\n", event_msg->u.event.dest);
|
||||||
|
partners_t *partnersList = NULL;
|
||||||
|
int j = 0;
|
||||||
|
|
||||||
|
int ret = validate_partner_id(event_msg, &partnersList);
|
||||||
|
if(ret == 1)
|
||||||
|
{
|
||||||
|
wrp_msg_t *eventMsg = (wrp_msg_t *) malloc(sizeof(wrp_msg_t));
|
||||||
|
eventMsg->msg_type = event_msg->msg_type;
|
||||||
|
eventMsg->u.event.content_type=event_msg->u.event.content_type;
|
||||||
|
eventMsg->u.event.source=event_msg->u.event.source;
|
||||||
|
eventMsg->u.event.dest=event_msg->u.event.dest;
|
||||||
|
eventMsg->u.event.payload=event_msg->u.event.payload;
|
||||||
|
eventMsg->u.event.payload_size=event_msg->u.event.payload_size;
|
||||||
|
eventMsg->u.event.headers=event_msg->u.event.headers;
|
||||||
|
eventMsg->u.event.metadata=event_msg->u.event.metadata;
|
||||||
|
eventMsg->u.event.partner_ids = partnersList;
|
||||||
|
|
||||||
|
int size = wrp_struct_to( eventMsg, WRP_BYTES, &bytes );
|
||||||
|
if(size > 0)
|
||||||
|
{
|
||||||
|
sendUpstreamMsgToServer(&bytes, size);
|
||||||
|
}
|
||||||
|
free(eventMsg);
|
||||||
|
free(bytes);
|
||||||
|
bytes = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sendUpstreamMsgToServer((void **)(&bytes), len);
|
||||||
|
}
|
||||||
|
if(partnersList != NULL)
|
||||||
|
{
|
||||||
|
for(j=0; j<(int)partnersList->count; j++)
|
||||||
|
{
|
||||||
|
if(NULL != partnersList->partner_ids[j])
|
||||||
|
{
|
||||||
|
free(partnersList->partner_ids[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(partnersList);
|
||||||
|
}
|
||||||
|
partnersList = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void subscribeAsyncHandler( rbusHandle_t handle, rbusEventSubscription_t* subscription, rbusError_t error)
|
||||||
|
{
|
||||||
|
ParodusInfo("subscribeAsyncHandler event %s, error %d - %s\n",subscription->eventName, error, rbusError_ToString(error));
|
||||||
|
}
|
||||||
@@ -335,6 +335,7 @@ void test_createSocketConnection()
|
|||||||
|
|
||||||
void test_createSocketConnection1()
|
void test_createSocketConnection1()
|
||||||
{
|
{
|
||||||
|
numLoops =0;
|
||||||
noPollCtx *ctx;
|
noPollCtx *ctx;
|
||||||
ParodusCfg cfg;
|
ParodusCfg cfg;
|
||||||
memset(&cfg,0, sizeof(ParodusCfg));
|
memset(&cfg,0, sizeof(ParodusCfg));
|
||||||
@@ -364,11 +365,11 @@ void test_createSocketConnection1()
|
|||||||
expect_function_call(nopoll_ctx_unref);
|
expect_function_call(nopoll_ctx_unref);
|
||||||
expect_function_call(nopoll_cleanup_library);
|
expect_function_call(nopoll_cleanup_library);
|
||||||
createSocketConnection(NULL);
|
createSocketConnection(NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_PingMissIntervalTime()
|
void test_PingMissIntervalTime()
|
||||||
{
|
{
|
||||||
|
numLoops = 6;
|
||||||
noPollCtx *ctx;
|
noPollCtx *ctx;
|
||||||
ParodusCfg cfg;
|
ParodusCfg cfg;
|
||||||
memset(&cfg,0,sizeof(ParodusCfg));
|
memset(&cfg,0,sizeof(ParodusCfg));
|
||||||
@@ -386,7 +387,6 @@ void test_PingMissIntervalTime()
|
|||||||
//Max ping timeout is 6 sec
|
//Max ping timeout is 6 sec
|
||||||
cfg.webpa_ping_timeout = 6;
|
cfg.webpa_ping_timeout = 6;
|
||||||
set_parodus_cfg(&cfg);
|
set_parodus_cfg(&cfg);
|
||||||
|
|
||||||
reset_close_retry();
|
reset_close_retry();
|
||||||
expect_function_call(nopoll_thread_handlers);
|
expect_function_call(nopoll_thread_handlers);
|
||||||
|
|
||||||
@@ -422,11 +422,11 @@ void test_PingMissIntervalTime()
|
|||||||
expect_function_call(nopoll_ctx_unref);
|
expect_function_call(nopoll_ctx_unref);
|
||||||
expect_function_call(nopoll_cleanup_library);
|
expect_function_call(nopoll_cleanup_library);
|
||||||
createSocketConnection(NULL);
|
createSocketConnection(NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void err_createSocketConnection()
|
void err_createSocketConnection()
|
||||||
{
|
{
|
||||||
|
numLoops =0;
|
||||||
set_close_retry();
|
set_close_retry();
|
||||||
reset_heartBeatTimer();
|
reset_heartBeatTimer();
|
||||||
expect_function_call(nopoll_thread_handlers);
|
expect_function_call(nopoll_thread_handlers);
|
||||||
@@ -459,6 +459,7 @@ void err_createSocketConnection()
|
|||||||
|
|
||||||
void test_createSocketConnection_cloud_disconn()
|
void test_createSocketConnection_cloud_disconn()
|
||||||
{
|
{
|
||||||
|
numLoops =0;
|
||||||
ParodusCfg cfg;
|
ParodusCfg cfg;
|
||||||
memset(&cfg,0,sizeof(ParodusCfg));
|
memset(&cfg,0,sizeof(ParodusCfg));
|
||||||
cfg.cloud_disconnect = strdup("XPC");
|
cfg.cloud_disconnect = strdup("XPC");
|
||||||
|
|||||||
Reference in New Issue
Block a user