mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-08 16:11:18 +00:00
fix ARP timeout
This commit is contained in:
1 parent
e5ab1c454b
commit
5754e5dd59
2 files changed
+4
-4
No files matched your search
+2
-2
@@ -8570,7 +8570,7 @@ static void mg_tcpip_poll(struct mg_tcpip_if *ifp, uint64_t uptime_ms) {
|
|||||||
// Process timeouts
|
// Process timeouts
|
||||||
for (struct mg_connection *c = ifp->mgr->conns; c != NULL; c = c->next) {
|
for (struct mg_connection *c = ifp->mgr->conns; c != NULL; c = c->next) {
|
||||||
if (c->is_udp || c->is_listening) continue;
|
if (c->is_udp || c->is_listening) continue;
|
||||||
if (c->is_connecting || c->is_resolving) continue;
|
if (!c->is_arplooking && (c->is_connecting || c->is_resolving)) continue;
|
||||||
struct connstate *s = (struct connstate *) (c + 1);
|
struct connstate *s = (struct connstate *) (c + 1);
|
||||||
uint32_t rem_ip;
|
uint32_t rem_ip;
|
||||||
memcpy(&rem_ip, c->rem.ip, sizeof(uint32_t));
|
memcpy(&rem_ip, c->rem.ip, sizeof(uint32_t));
|
||||||
@@ -8672,7 +8672,7 @@ void mg_connect_resolved(struct mg_connection *c) {
|
|||||||
&c->rem));
|
&c->rem));
|
||||||
mg_call(c, MG_EV_RESOLVE, NULL);
|
mg_call(c, MG_EV_RESOLVE, NULL);
|
||||||
if (((rem_ip & ifp->mask) == (ifp->ip & ifp->mask))) {
|
if (((rem_ip & ifp->mask) == (ifp->ip & ifp->mask))) {
|
||||||
// If we're in the same LAN, fire an ARP lookup. TODO(cpq): handle this!
|
// If we're in the same LAN, fire an ARP lookup.
|
||||||
MG_DEBUG(("%lu ARP lookup...", c->id));
|
MG_DEBUG(("%lu ARP lookup...", c->id));
|
||||||
arp_ask(ifp, rem_ip);
|
arp_ask(ifp, rem_ip);
|
||||||
settmout(c, MIP_TTYPE_ARP);
|
settmout(c, MIP_TTYPE_ARP);
|
||||||
|
|||||||
+2
-2
@@ -847,7 +847,7 @@ static void mg_tcpip_poll(struct mg_tcpip_if *ifp, uint64_t uptime_ms) {
|
|||||||
// Process timeouts
|
// Process timeouts
|
||||||
for (struct mg_connection *c = ifp->mgr->conns; c != NULL; c = c->next) {
|
for (struct mg_connection *c = ifp->mgr->conns; c != NULL; c = c->next) {
|
||||||
if (c->is_udp || c->is_listening) continue;
|
if (c->is_udp || c->is_listening) continue;
|
||||||
if (c->is_connecting || c->is_resolving) continue;
|
if (!c->is_arplooking && (c->is_connecting || c->is_resolving)) continue;
|
||||||
struct connstate *s = (struct connstate *) (c + 1);
|
struct connstate *s = (struct connstate *) (c + 1);
|
||||||
uint32_t rem_ip;
|
uint32_t rem_ip;
|
||||||
memcpy(&rem_ip, c->rem.ip, sizeof(uint32_t));
|
memcpy(&rem_ip, c->rem.ip, sizeof(uint32_t));
|
||||||
@@ -949,7 +949,7 @@ void mg_connect_resolved(struct mg_connection *c) {
|
|||||||
&c->rem));
|
&c->rem));
|
||||||
mg_call(c, MG_EV_RESOLVE, NULL);
|
mg_call(c, MG_EV_RESOLVE, NULL);
|
||||||
if (((rem_ip & ifp->mask) == (ifp->ip & ifp->mask))) {
|
if (((rem_ip & ifp->mask) == (ifp->ip & ifp->mask))) {
|
||||||
// If we're in the same LAN, fire an ARP lookup. TODO(cpq): handle this!
|
// If we're in the same LAN, fire an ARP lookup.
|
||||||
MG_DEBUG(("%lu ARP lookup...", c->id));
|
MG_DEBUG(("%lu ARP lookup...", c->id));
|
||||||
arp_ask(ifp, rem_ip);
|
arp_ask(ifp, rem_ip);
|
||||||
settmout(c, MIP_TTYPE_ARP);
|
settmout(c, MIP_TTYPE_ARP);
|
||||||
|
|||||||
Reference in new issue
Block a user