wangzhengquan
2021-02-04 83956b12d863924936a98c9dfbece37feb0cce9c
src/net/net_mod_socket.cpp
@@ -19,30 +19,30 @@
  if (Signal(SIGPIPE, SIG_IGN) == SIG_ERR)
    logger->error(errno, "NetModSocket::NetModSocket signal");
  gpool = new NetConnPool();
  // gpool = new NetConnPool();
  pthread_mutexattr_t mtxAttr;
  s = pthread_mutexattr_init(&mtxAttr);
  if (s != 0)
    err_exit(s, "pthread_mutexattr_init");
  s = pthread_mutexattr_settype(&mtxAttr, PTHREAD_MUTEX_ERRORCHECK);
  if (s != 0)
    err_exit(s, "pthread_mutexattr_settype");
  s = pthread_mutex_init(&sendMutex, &mtxAttr);
  if (s != 0)
    err_exit(s, "pthread_mutex_init");
  // pthread_mutexattr_t mtxAttr;
  // s = pthread_mutexattr_init(&mtxAttr);
  // if (s != 0)
  //   err_exit(s, "pthread_mutexattr_init");
  // s = pthread_mutexattr_settype(&mtxAttr, PTHREAD_MUTEX_ERRORCHECK);
  // if (s != 0)
  //   err_exit(s, "pthread_mutexattr_settype");
  // s = pthread_mutex_init(&sendMutex, &mtxAttr);
  // if (s != 0)
  //   err_exit(s, "pthread_mutex_init");
  s = pthread_mutexattr_destroy(&mtxAttr);
  if (s != 0)
    err_exit(s, "pthread_mutexattr_destroy");
  // s = pthread_mutexattr_destroy(&mtxAttr);
  // if (s != 0)
  //   err_exit(s, "pthread_mutexattr_destroy");
}
NetModSocket::~NetModSocket() {
  int s;
  delete gpool;
  s =  pthread_mutex_destroy(&sendMutex);
  // delete gpool;
  // s =  pthread_mutex_destroy(&sendMutex);
  if(s != 0) {
    err_exit(s, "shm_close_socket");
  }
@@ -498,22 +498,12 @@
}
int NetModSocket::recvandsend(recvandsend_callback_fn callback,
                              const struct timespec *timeout , int flag, void * user_data ) {
int NetModSocket::recvandsend(void **recvbuf, int *recvsize, int *key, recv_callback_fn callback) {
  return shmModSocket.recvandsend( recvbuf, recvsize, key, callback);
  return shmModSocket.recvandsend(callback, timeout, flag, user_data);
}
int NetModSocket::recvandsend_timeout(void **recvbuf, int *recvsize, int *key, recv_callback_fn callback,
                              const struct timespec *timeout ) {
  return shmModSocket.recvandsend( recvbuf, recvsize, key, callback, timeout, BUS_TIMEOUT_FLAG);
}
int NetModSocket::recvandsend_nowait(void **recvbuf, int *recvsize, int *key, recv_callback_fn callback) {
  return shmModSocket.recvandsend( recvbuf, recvsize, key, callback, NULL,  BUS_NOWAIT_FLAG);
}
/**
 * 发送请求信息并等待接收应答