mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 19:19:02 -04:00
add erroring if there are already 65536 id's in transit
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4669 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
43759fd180
commit
b7d632aa9a
@ -202,6 +202,9 @@ int DNSRequest::SendRequests(const DNSHeader *header, const int length, QueryTyp
|
||||
/* Add a query with a predefined header, and allocate an ID for it. */
|
||||
DNSRequest* DNS::AddQuery(DNSHeader *header, int &id)
|
||||
{
|
||||
if (requests.size() == DNS::MAX_REQUEST_ID + 1)
|
||||
return NULL;
|
||||
|
||||
id = this->PRNG() & DNS::MAX_REQUEST_ID;
|
||||
|
||||
/* This id is already 'in flight', pick another.
|
||||
@ -351,7 +354,7 @@ int DNS::GetIP(const char *name)
|
||||
|
||||
DNSRequest* req = this->AddQuery(&h, id);
|
||||
|
||||
if (req->SendRequests(&h, length, DNS_QUERY_A) == -1)
|
||||
if ((!req) || (req->SendRequests(&h, length, DNS_QUERY_A) == -1))
|
||||
return -1;
|
||||
|
||||
return id;
|
||||
@ -377,7 +380,7 @@ int DNS::GetName(const insp_inaddr *ip)
|
||||
|
||||
DNSRequest* req = this->AddQuery(&h, id);
|
||||
|
||||
if (req->SendRequests(&h, length, DNS_QUERY_PTR) == -1)
|
||||
if ((!req) || (req->SendRequests(&h, length, DNS_QUERY_PTR) == -1))
|
||||
return -1;
|
||||
|
||||
return id;
|
||||
|
Loading…
x
Reference in New Issue
Block a user