mirror of
https://github.com/cesanta/mongoose.git
synced 2026-12-04 21:58:22 +00:00
2 files changed
+12
-4
No files matched your search
+6
-2
@@ -376,8 +376,12 @@ static void mg_sendnsreq(struct mg_connection *c, struct mg_str *name, int ms,
|
|||||||
mg_error(c, "resolve OOM");
|
mg_error(c, "resolve OOM");
|
||||||
} else {
|
} else {
|
||||||
struct dns_data *reqs = (struct dns_data *) c->mgr->active_dns_requests;
|
struct dns_data *reqs = (struct dns_data *) c->mgr->active_dns_requests;
|
||||||
d->txnid = reqs ? (uint16_t) (reqs->txnid + 1) : 1;
|
uint16_t id;
|
||||||
d->next = (struct dns_data *) c->mgr->active_dns_requests;
|
mg_random(&id, sizeof(uint16_t));
|
||||||
|
// TODO(): traverse reqs and check id != reqs->txnid; repeat otherwise
|
||||||
|
if (reqs != NULL) id = (uint16_t) (reqs->txnid + 1); // no collision
|
||||||
|
d->txnid = id;
|
||||||
|
d->next = reqs;
|
||||||
c->mgr->active_dns_requests = d;
|
c->mgr->active_dns_requests = d;
|
||||||
d->expire = mg_millis() + (uint64_t) ms;
|
d->expire = mg_millis() + (uint64_t) ms;
|
||||||
d->c = c;
|
d->c = c;
|
||||||
|
|||||||
@@ -255,8 +255,12 @@ static void mg_sendnsreq(struct mg_connection *c, struct mg_str *name, int ms,
|
|||||||
mg_error(c, "resolve OOM");
|
mg_error(c, "resolve OOM");
|
||||||
} else {
|
} else {
|
||||||
struct dns_data *reqs = (struct dns_data *) c->mgr->active_dns_requests;
|
struct dns_data *reqs = (struct dns_data *) c->mgr->active_dns_requests;
|
||||||
d->txnid = reqs ? (uint16_t) (reqs->txnid + 1) : 1;
|
uint16_t id;
|
||||||
d->next = (struct dns_data *) c->mgr->active_dns_requests;
|
mg_random(&id, sizeof(uint16_t));
|
||||||
|
// TODO(): traverse reqs and check id != reqs->txnid; repeat otherwise
|
||||||
|
if (reqs != NULL) id = (uint16_t) (reqs->txnid + 1); // no collision
|
||||||
|
d->txnid = id;
|
||||||
|
d->next = reqs;
|
||||||
c->mgr->active_dns_requests = d;
|
c->mgr->active_dns_requests = d;
|
||||||
d->expire = mg_millis() + (uint64_t) ms;
|
d->expire = mg_millis() + (uint64_t) ms;
|
||||||
d->c = c;
|
d->c = c;
|
||||||
|
|||||||
Reference in new issue
Block a user