zhangmeng
2022-01-17 b4bda4a8e6aa1acf5e161a95642e944e08c72646
src/nng_wrap.cpp
@@ -162,6 +162,7 @@
}
int publish(const std::string& topic, const void* data, const int data_len, void* arg/*=NULL*/){
    // printf("======>> publish topic %s\n", topic.c_str());
    _ps* pub = (_ps*)arg;
    if (!pub) pub = singleton<_ps>();
@@ -214,7 +215,7 @@
                {
                    lock_guard<mutex> l{(*sub)()};
                    for(auto && i : sub->topics_){
                        if (i.compare(topic) == 0){
                        if (!!!i.compare(topic)){
                            msg = move(tmp_msg.substr(i.size()+1));
                            break;
                        }
@@ -512,6 +513,7 @@
        get<1>(get<1>(rep->socks_)) = port;
        ipc = "tcp://0.0.0.0:" + to_string(port);
        if(create_server(&get<0>(get<1>(rep->socks_)), ipc, 62, rep) != 0) return -1;
        printf("======>> create server for remote port %d\n", port);
    }else {
        get<0>(get<1>(rep->socks_)).id = numeric_limits<int32_t>::max();
    }
@@ -564,7 +566,7 @@
            return !rep->msg_.empty();
        });
        if (!status){
            PRNTVITAG("subscribe_read timeout");
            PRNTVITAG("read_request timeout");
            return -1;
        }
        auto iter = rep->msg_.begin();