1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-15 15:53:55 +00:00

Fixed bug, where if DNS resolve fails, an attempt is made to fetch cache results, but the result was accidentally left on the value stack

This commit is contained in:
Bryan Roe
2020-02-24 15:45:15 -08:00
parent ffcffafeb5
commit f11fb9d3cb

View File

@@ -456,12 +456,13 @@ duk_ret_t ILibDuktape_net_socket_connect(duk_context *ctx)
if (duk_has_prop_string(ctx, -1, "_sharedDB"))
{
ILibSimpleDataStore db = (ILibSimpleDataStore)Duktape_GetPointerProperty(ctx, -1, "_sharedDB");
char *dnsCache = (char*)duk_push_sprintf(ctx, "DNS[%s]", host);
char *dnsCache = (char*)duk_push_sprintf(ctx, "DNS[%s]", host); // [dnsCache]
char dnsCacheBuffer[255];
if (ILibSimpleDataStore_Get(db, dnsCache, dnsCacheBuffer, sizeof(dnsCacheBuffer)) > 0)
{
ILibResolveEx(dnsCacheBuffer, (unsigned short)port, &dest);
}
duk_pop(ctx); // ...
}
}
if (dest.sin6_family == AF_UNSPEC || (duk_is_object(ctx, 0) && duk_has_prop_string(ctx, 0, "proxy") && proxy.sin6_family == AF_UNSPEC))