Fix the buf data parse issue.
| | |
| | | |
| | | logger->error("in BHRegisterTopics: Out of memory!\n"); |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | goto exit_entry; |
| | | } |
| | | memset(topics_buf, 0x00, total); |
| | |
| | | |
| | | #else |
| | | memcpy(topics_buf, topics, topics_len); |
| | | count = topics_len; |
| | | #endif |
| | | |
| | | rv = net_mod_socket_reg(gNetmod_socket, topics_buf, strlen(topics_buf) + 1, NULL, 0, timeout_ms, PROC_REG_TCS); |
| | | rv = net_mod_socket_reg(gNetmod_socket, topics_buf, count, NULL, 0, timeout_ms, PROC_REG_TCS); |
| | | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | |
| | | buf = const_cast<void *>(topic); |
| | | strncpy(topics_buf, (const char *)buf, min); |
| | | #endif |
| | | rv = net_mod_socket_reg(gNetmod_socket, topics_buf, strlen(topics_buf) + 1, &buf, &size, timeout_ms, PROC_QUE_TCS); |
| | | rv = net_mod_socket_reg(gNetmod_socket, topics_buf, min, &buf, &size, timeout_ms, PROC_QUE_TCS); |
| | | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | |
| | | |
| | | logger->error("in BHSubscribeTopics: Out of memory!\n"); |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | goto exit_entry; |
| | | } |
| | | memset(topics_buf, 0x00, total); |
| | |
| | | |
| | | #else |
| | | memcpy(topics_buf, topics, topics_len); |
| | | count = topics_len; |
| | | #endif |
| | | |
| | | if (timeout_ms > 0) { |
| | | |
| | | sec = timeout_ms / 1000; |
| | | nsec = (timeout_ms - sec * 1000) * 1000 * 1000; |
| | | rv = net_mod_socket_sub_timeout(gNetmod_socket, topics_buf, strlen(topics_buf) + 1, sec, nsec); |
| | | rv = net_mod_socket_sub_timeout(gNetmod_socket, topics_buf, count, sec, nsec); |
| | | |
| | | } else if (timeout_ms == 0) { |
| | | |
| | | rv = net_mod_socket_sub_nowait(gNetmod_socket, topics_buf, strlen(topics_buf) + 1); |
| | | rv = net_mod_socket_sub_nowait(gNetmod_socket, topics_buf, count); |
| | | |
| | | } else { |
| | | |
| | | rv = net_mod_socket_sub(gNetmod_socket, topics_buf, strlen(topics_buf) + 1); |
| | | rv = net_mod_socket_sub(gNetmod_socket, topics_buf, count); |
| | | |
| | | } |
| | | |
| | |
| | | memcpy(*proc_id, topics_buf, *proc_id_len); |
| | | |
| | | #endif |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | } else { |
| | | |