| | |
| | | |
| | | if (!w) return -1; |
| | | |
| | | *src = malloc(sizeof(uint64_t)); |
| | | *(uint64_t*)(*src) = key; |
| | | *src = malloc(sizeof(key)); |
| | | memcpy(*src, &key, sizeof(key)); |
| | | |
| | | return w->mode; |
| | | } |
| | | |
| | | int send_reply(const void* src, const void* msg, const int msg_len, void* arg/*=NULL*/){ |
| | | int send_reply(void* src, const void* msg, const int msg_len, void* arg/*=NULL*/){ |
| | | _rr* rep = (_rr*)arg; |
| | | if (!rep) rep = singleton<_rr>(); |
| | | |
| | | struct work* w{}; |
| | | { |
| | | auto key = *(static_cast<uint64_t*>(const_cast<void*>(src))); |
| | | free(const_cast<void*>(src)); |
| | | uint64_t key; |
| | | memcpy(&key, src, sizeof(key)); |
| | | // auto key = *(static_cast<uint64_t*>(const_cast<void*>(src))); |
| | | free(src); |
| | | |
| | | lock_guard<mutex> l{rep->mtx_msg_}; |
| | | auto iter = rep->works_.find(key); |
| | |
| | | void** reply, int* reply_len, const int to_ms, void* arg=NULL); |
| | | int start_reply(const std::string& url, const int port, void* arg=NULL); |
| | | int read_request(void** src, std::string* msg, const int to_ms, void* arg=NULL); |
| | | int send_reply(const void* src, const void* msg, const int msg_len, void* arg=NULL); |
| | | int send_reply(void* src, const void* msg, const int msg_len, void* arg=NULL); |
| | | |
| | | } |
| | | |