| | |
| | | |
| | | static int gRun_stat = 0; |
| | | static void *gNetmod_socket = NULL; |
| | | static std::map<std::string, int> gRecvbuf; |
| | | |
| | | static pthread_mutex_t mutex; |
| | | |
| | |
| | | std::string str; |
| | | std::string MsgID; |
| | | int timeout_ms = 3000; |
| | | std::map<std::string, int>::iterator recvIter; |
| | | char data_buf[MAX_STR_LEN] = { 0x00 }; |
| | | char buf_temp[MAX_STR_LEN] = { 0x00 }; |
| | | char *topics_buf = NULL; |
| | |
| | | #endif |
| | | |
| | | str = buf_temp; |
| | | recvIter = gRecvbuf.find(str); |
| | | if(recvIter != gRecvbuf.end()) { |
| | | val = net_mod_socket_buf_data_get(gNetmod_socket, str); |
| | | if(val > 0) { |
| | | |
| | | rv = 0; |
| | | val = recvIter->second; |
| | | |
| | | } else { |
| | | rv = net_mod_socket_reg(gNetmod_socket, buf_temp, strlen(buf_temp), &buf, &size, timeout_ms, PROC_QUE_STCS); |
| | |
| | | val = atoi((char *)data_buf); |
| | | if (val > 0) { |
| | | str = buf_temp; |
| | | gRecvbuf.insert({str, val}); |
| | | net_mod_socket_buf_data_set(gNetmod_socket, str, val); |
| | | } |
| | | |
| | | free(buf); |
| | |
| | | net_mod_err_t *errarr; |
| | | int errarr_size = 0; |
| | | char *errString = NULL; |
| | | std::map<std::string, int>::iterator recvIter; |
| | | char buf_temp[MAX_STR_LEN] = { 0x00 }; |
| | | char *topics_buf = NULL; |
| | | |
| | |
| | | #endif |
| | | |
| | | str = buf_temp; |
| | | recvIter = gRecvbuf.find(str); |
| | | if(recvIter != gRecvbuf.end()) { |
| | | val = net_mod_socket_buf_data_get(gNetmod_socket, str); |
| | | if(val > 0) { |
| | | |
| | | rv = 0; |
| | | val = recvIter->second; |
| | | |
| | | } else { |
| | | rv = net_mod_socket_reg(gNetmod_socket, buf_temp, strlen(buf_temp), &buf, &size, timeout_ms, PROC_QUE_STCS); |
| | |
| | | val = atoi((char *)data_buf); |
| | | if (val > 0) { |
| | | str = buf_temp; |
| | | gRecvbuf.insert({str, val}); |
| | | net_mod_socket_buf_data_set(gNetmod_socket, str, val); |
| | | } |
| | | |
| | | free(buf); |