fujuntang
2021-10-23 bae3a4fd9406635608edf0c0d16c52cf7ca06a66
src/bh_api.cpp
@@ -18,7 +18,6 @@
static int gRun_stat = 0;
static void *gNetmod_socket = NULL;
static std::map<std::string, int> gRecvbuf;
static pthread_mutex_t mutex;
@@ -1202,7 +1201,6 @@
  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;
@@ -1265,11 +1263,10 @@
#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);
@@ -1280,7 +1277,7 @@
      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);
@@ -1381,7 +1378,6 @@
  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;
  
@@ -1450,11 +1446,10 @@
#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);
@@ -1465,7 +1460,7 @@
      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);