static void register_subject_callbacks()
{
- static bool done = false;
+ conv::dbus_client::register_callback(CONV_SUBJECT_DISCOVERY_START, conv_subject_cb);
- if (!done) {
- conv::dbus_client::register_callback(CONV_SUBJECT_DISCOVERY_START, conv_subject_cb);
- done = true;
- }
_I("Done with registering subject callback");
}
//LCOV_EXCL_STOP
static void register_subject_callbacks()
{
- static bool done = false;
+ conv::dbus_client::register_callback(CONV_SUBJECT_COMMUNICATION_RECV, conv_subject_cb);
+ conv::dbus_client::register_callback(CONV_SUBJECT_CONNECTION_START, conv_connect_subject_cb);
- if (!done) {
- conv::dbus_client::register_callback(CONV_SUBJECT_COMMUNICATION_RECV, conv_subject_cb);
- conv::dbus_client::register_callback(CONV_SUBJECT_CONNECTION_START, conv_connect_subject_cb);
- done = true;
- }
_I("Done with registering subject callback");
}
//LCOV_EXCL_STOP
_I("Registering callback for subject '%s'", subject);
_I("response_cb_map : %x", response_cb_map);
- response_cb_map->insert(std::pair<std::string, subject_response_cb> (subject, callback));
-
- _D("registering done..");
+ if (response_cb_map->find(subject) == response_cb_map->end()) {
+ response_cb_map->insert(std::pair<std::string, subject_response_cb> (subject, callback));
+ _D("registering done..");
+ } else {
+ _I("Already registered for subject %s", subject);
+ }
return true;
}