zhangmeng
2023-01-29 e4cb33f25012c534f0582d485c4f491f9dd3cd25
src/common.h
@@ -17,17 +17,20 @@
namespace nng_wrap {
static thread_local std::string verbose_info{};
#define TAG
#define PRNTVITAG(args)
/*
#ifndef PRNTVITAG
static thread_local std::string verbose_info{};
#define TAG do{ verbose_info.clear(); \
                verbose_info=string("function [")+__FUNCTION__+string("]"); \
            }while(0)
#define PRNTVITAG(msg) do{ \
            verbose_info+=string("-> (") + msg + string(")"); \
        }while(0)
// #define TAG
// #define PRNTVITAG(args)
#endif
*/
/////////////////////////////////////////////////
enum{
@@ -92,7 +95,7 @@
};
template <class T> using is_callable = typename is_callable_h<std::is_class<typename std::remove_reference<T>::type>::value, typename std::remove_reference<T>::type>::type;
static constexpr int timeout_req_rep = 5162;
static constexpr int timeout_req_rep = 6251;
inline void remove_exist(const std::string& url){
    if (url.find("ipc://") == 0){
@@ -140,6 +143,7 @@
    int operator()(){return msg_.size();}
    virtual ~_ps(){
        t_quit_.store(true, std::memory_order_relaxed);
        cv_msg_.notify_all();
        if (t_.joinable()) t_.join();
    }
@@ -178,6 +182,7 @@
};
enum { INIT, RECV, WAIT, SEND };
enum { REPLY_IPC, REPLY_TCP };
struct work {
    int state{-1};
    nng_aio *aio{};
@@ -185,6 +190,7 @@
    nng_ctx  ctx{};
    void(*cb_recv)(work*){};
    void* user_data{};
    int mode{-1};
};
static const std::string rr_unblocking_msg_{"~!@#$%^&*()-=<<UNBLOCKING>>=-()*&^%$#@!~"};