Similar map changes for async requests

This commit is contained in:
Tim Wojtulewicz 2022-02-07 14:49:55 -07:00
parent e8f833b8a6
commit b531ec97ef
2 changed files with 42 additions and 55 deletions

View file

@ -256,7 +256,7 @@ protected:
// requested.
void CheckAsyncAddrRequest(const IPAddr& addr, bool timeout);
void CheckAsyncHostRequest(const std::string& host, bool timeout);
void CheckAsyncTextRequest(const std::string& host, bool timeout);
void CheckAsyncOtherRequest(const std::string& host, bool timeout, int request_type);
void Event(EventHandlerPtr e, DNS_Mapping* dm);
void Event(EventHandlerPtr e, DNS_Mapping* dm, ListValPtr l1, ListValPtr l2);
@ -303,10 +303,13 @@ protected:
IPAddr addr;
std::string host;
CallbackList callbacks;
bool is_txt = false;
int type = 0;
bool processed = false;
bool IsAddrReq() const { return host.empty(); }
AsyncRequest(std::string host, int request_type) : host(std::move(host)), type(request_type)
{
}
AsyncRequest(const IPAddr& addr) : addr(addr), type(T_PTR) { }
void Resolved(const std::string& name);
void Resolved(TableValPtr addrs);
@ -318,14 +321,8 @@ protected:
bool operator()(const AsyncRequest* a, const AsyncRequest* b) { return a->time > b->time; }
};
using AsyncRequestAddrMap = std::map<IPAddr, AsyncRequest*>;
AsyncRequestAddrMap asyncs_addrs;
using AsyncRequestNameMap = std::map<std::string, AsyncRequest*>;
AsyncRequestNameMap asyncs_names;
using AsyncRequestTextMap = std::map<std::string, AsyncRequest*>;
AsyncRequestTextMap asyncs_texts;
using AsyncRequestMap = std::map<MappingKey, AsyncRequest*>;
AsyncRequestMap asyncs;
using QueuedList = std::list<AsyncRequest*>;
QueuedList asyncs_queued;