Skip to content

Commit

Permalink
Merge branch 'Opendirect_rawdata' of github.com:gururaajar/rbus into …
Browse files Browse the repository at this point in the history
…Opendirect_rawdata
  • Loading branch information
Gururaaja E S R authored and Gururaaja E S R committed Nov 21, 2023
2 parents c2ad9fa + 280e5c5 commit cbe4779
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/core/rbuscore.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ rbusCoreError_t rbus_unregisterObj(const char * object_name)
return RBUSCORE_ERROR_INVALID_PARAM;
}

err = rtConnection_RemoveListener(g_connection, RBUS_REGISTER_OBJECT_EXPRESSION_ID);
err = rtConnection_RemoveListener(g_connection, object_name, RBUS_REGISTER_OBJECT_EXPRESSION_ID);
if(RT_OK != err)
{
RBUSCORELOG_ERROR("rtConnection_RemoveListener %s failed: Err=%d", object_name, err);
Expand Down Expand Up @@ -1718,7 +1718,7 @@ rbusCoreError_t rbus_unregisterClientDisconnectHandler()
lock();
if(g_advisory_listener_installed)
{
rtConnection_RemoveListener(g_connection, RBUS_ADVISORY_EXPRESSION_ID);
rtConnection_RemoveListener(g_connection, RTMSG_ADVISORY_TOPIC, RBUS_ADVISORY_EXPRESSION_ID);
g_advisory_listener_installed = false;
}
unlock();
Expand Down
6 changes: 3 additions & 3 deletions src/rbus/rbus_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ rbusError_t rbusMessage_RemovePrivateListener(
RBUS_MESSAGE_MUTEX_LOCK();
rtVector_RemoveItemByCompare(handle->messageCallbacks, rawDataTopic, compareContextExpression, cleanupContext);

rtError e = rtConnection_RemoveListener(myConn, subscriptionId);
rtError e = rtConnection_RemoveListener(myConn, rawDataTopic, subscriptionId);
RBUS_MESSAGE_MUTEX_UNLOCK();
if (e != RT_OK)
{
Expand All @@ -229,7 +229,7 @@ rbusError_t rbusMessage_RemoveListener(
RBUS_MESSAGE_MUTEX_LOCK();
rtVector_RemoveItemByCompare(handle->messageCallbacks, expression, compareContextExpression, cleanupContext);

rtError e = rtConnection_RemoveListener(con, subscriptionId);
rtError e = rtConnection_RemoveListener(con, expression, subscriptionId);
RBUS_MESSAGE_MUTEX_UNLOCK();
if (e != RT_OK)
{
Expand All @@ -252,7 +252,7 @@ rbusError_t rbusMessage_RemoveAllListeners(
{
rbusMessageHandlerContext_t* ctx = rtVector_At(handle->messageCallbacks, i);
VERIFY_NULL(ctx);
rtError e = rtConnection_RemoveListener(con, ctx->subscriptionId);
rtError e = rtConnection_RemoveListener(con, ctx->expression, ctx->subscriptionId);
if (e != RT_OK)
{
RBUSLOG_WARN("rbusMessage_RemoveAllListener %s :%s", ctx->expression, rtStrError(e));
Expand Down
4 changes: 1 addition & 3 deletions src/rtmessage/rtConnection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1264,11 +1264,10 @@ rtConnection_AddListener(rtConnection con, char const* expression, uint32_t expr
}

rtError
rtConnection_RemoveListener(rtConnection con, uint32_t expressionId)
rtConnection_RemoveListener(rtConnection con, char const* expression, uint32_t expressionId)
{
int i;
int route_id = 0;
char expression[RTMSG_HEADER_MAX_TOPIC_LENGTH] = {0};

if (!con)
return rtErrorFromErrno(EINVAL);
Expand All @@ -1278,7 +1277,6 @@ rtConnection_RemoveListener(rtConnection con, uint32_t expressionId)
{
if ((con->listeners[i].in_use) && (expressionId == con->listeners[i].subscription_id))
{
strncpy(expression, con->listeners[i].expression, RTMSG_HEADER_MAX_TOPIC_LENGTH);
con->listeners[i].in_use = 0;
route_id = con->listeners[i].subscription_id;
con->listeners[i].subscription_id = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/rtmessage/rtConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ rtConnection_AddListener(rtConnection con, char const* expression,
* @return error
*/
rtError
rtConnection_RemoveListener(rtConnection con, uint32_t expressionId);
rtConnection_RemoveListener(rtConnection con, char const* expression, uint32_t expressionId);

/**
* Add an alias to an existing listener
Expand Down

0 comments on commit cbe4779

Please sign in to comment.