| | |
| | | { |
| | | typedef std::atomic<uint64_t> Number; |
| | | |
| | | void GetApiError(int &ec, std::string &msg) |
| | | { |
| | | void *pmsg = 0; |
| | | int msg_len = 0; |
| | | ec = BHGetLastError(&pmsg, &msg_len); |
| | | msg.assign((char *) pmsg, msg_len); |
| | | BHFree(pmsg, msg_len); |
| | | } |
| | | |
| | | void Assign(Number &a, const Number &b) { a.store(b.load()); } |
| | | struct MsgStatus { |
| | | |
| | |
| | | // if (!reg) { |
| | | // int ec = 0; |
| | | // std::string msg; |
| | | // GetLastError(ec, msg); |
| | | // GetApiError(ec, msg); |
| | | // printf("reg error: %s\n", msg.c_str()); |
| | | // } |
| | | } else { |
| | | int ec = 0; |
| | | std::string msg; |
| | | GetLastError(ec, msg); |
| | | GetApiError(ec, msg); |
| | | printf("register failed, %d, %s\n", ec, msg.c_str()); |
| | | } |
| | | |
| | |
| | | if (!r) { |
| | | int ec = 0; |
| | | std::string msg; |
| | | GetLastError(ec, msg); |
| | | GetApiError(ec, msg); |
| | | printf("topic query proc error: %s\n", msg.c_str()); |
| | | } else { |
| | | MsgRequestTopicReply ret; |
| | |
| | | if (!r) { |
| | | int ec = 0; |
| | | std::string msg; |
| | | GetLastError(ec, msg); |
| | | GetApiError(ec, msg); |
| | | printf("request error: %s\n", msg.c_str()); |
| | | } else { |
| | | MsgRequestTopicReply ret; |
| | |
| | | if (last.exchange(now) < now) { |
| | | int ec = 0; |
| | | std::string msg; |
| | | GetLastError(ec, msg); |
| | | GetApiError(ec, msg); |
| | | printf("request topic error --------- : %s\n", msg.c_str()); |
| | | } |
| | | } |