mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-10 21:33:38 +00:00
1. Updated so that .msh is read earlier, allowing --nocertstore switch to work as msh flag
2. Added --skipmaccheck 3. Updated behavior of websocket to not call removeAllListeners() on cleanup
This commit is contained in:
@@ -4552,6 +4552,21 @@ int MeshAgent_AgentMode(MeshAgentHostContainer *agentHost, int paramLen, char **
|
||||
}
|
||||
paramLen -= ixr;
|
||||
|
||||
// Check to see if we need to import a settings file
|
||||
if (importSettings(agentHost, MeshAgent_MakeAbsolutePath(agentHost->exePath, ".mshx")) == 0)
|
||||
{
|
||||
if (importSettings(agentHost, MeshAgent_MakeAbsolutePath(agentHost->exePath, ".msh")) == 0)
|
||||
{
|
||||
if ((importSettings(agentHost, "mesh_linumshx") == 0) && (importSettings(agentHost, "mesh_limshx") == 0)) // Do this because the old agent would generate this bad file name on linux.
|
||||
{
|
||||
// Let's check to see if an .msh was embedded into our binary
|
||||
checkForEmbeddedMSH(agentHost);
|
||||
importSettings(agentHost, MeshAgent_MakeAbsolutePath(agentHost->exePath, ".msh"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
if (agentHost->noCertStore == 0) { agentHost->noCertStore = ILibSimpleDataStore_Get(agentHost->masterDb, "nocertstore", NULL, 0); }
|
||||
#endif
|
||||
@@ -4777,6 +4792,8 @@ int MeshAgent_AgentMode(MeshAgentHostContainer *agentHost, int paramLen, char **
|
||||
#endif
|
||||
#if !defined(MICROSTACK_NOTLS)
|
||||
|
||||
if (ILibSimpleDataStore_Get(agentHost->masterDb, "skipmaccheck", NULL, 0) == 0)
|
||||
{
|
||||
// Check the local MacAddresses, to see if we need to reset our NodeId
|
||||
if (duk_peval_string(tmpCtx, "(function _getMac() { var ret = ''; var ni = require('os').networkInterfaces(); for (var f in ni) { for (var i in ni[f]) { if(ni[f][i].type == 'ethernet' || ni[f][i].type == 'wireless') {ret += ('[' + ni[f][i].mac + ']');} } } return(ret); })();") == 0)
|
||||
{
|
||||
@@ -4826,6 +4843,7 @@ int MeshAgent_AgentMode(MeshAgentHostContainer *agentHost, int paramLen, char **
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Duktape_SafeDestroyHeap(tmpCtx);
|
||||
|
||||
// Load the mesh agent certificates
|
||||
@@ -4864,20 +4882,6 @@ int MeshAgent_AgentMode(MeshAgentHostContainer *agentHost, int paramLen, char **
|
||||
}
|
||||
}
|
||||
|
||||
// Check to see if we need to import a settings file
|
||||
if (importSettings(agentHost, MeshAgent_MakeAbsolutePath(agentHost->exePath, ".mshx")) == 0)
|
||||
{
|
||||
if (importSettings(agentHost, MeshAgent_MakeAbsolutePath(agentHost->exePath, ".msh")) == 0)
|
||||
{
|
||||
if ((importSettings(agentHost, "mesh_linumshx") == 0) && (importSettings(agentHost, "mesh_limshx") == 0)) // Do this because the old agent would generate this bad file name on linux.
|
||||
{
|
||||
// Let's check to see if an .msh was embedded into our binary
|
||||
checkForEmbeddedMSH(agentHost);
|
||||
importSettings(agentHost, MeshAgent_MakeAbsolutePath(agentHost->exePath, ".msh"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check to see if any capabilities are specified in the db
|
||||
{
|
||||
int dbCapabilities = 0;
|
||||
|
||||
@@ -4433,17 +4433,6 @@ void ILibDuktape_httpStream_webSocket_EncodedEndSink(ILibDuktape_DuplexStream *s
|
||||
duk_del_prop_string(state->ctx, -1, ILibDuktape_WSDEC2WS);
|
||||
duk_prepare_method_call(state->ctx, -1, "unpipe"); // [websocket][decoded][pmc][this]
|
||||
duk_pcall_method(state->ctx, 0); duk_pop(state->ctx); // [websocket][decoded]
|
||||
duk_prepare_method_call(state->ctx, -1, "removeAllListeners"); // [websocket][decoded][removeAll][this]
|
||||
duk_pcall_method(state->ctx, 0); duk_pop(state->ctx); // [websocket][decoded]
|
||||
|
||||
duk_pop(state->ctx); // [websocket]
|
||||
duk_get_prop_string(state->ctx, -1, "encoded"); // [websocket][encoded]
|
||||
duk_prepare_method_call(state->ctx, -1, "removeAllListeners"); // [websocket][encoded][removeAll][this]
|
||||
duk_pcall_method(state->ctx, 0); duk_pop(state->ctx); // [websocket][encoded]
|
||||
|
||||
duk_del_prop_string(state->ctx, -1, ILibDuktape_WSENC2WS);
|
||||
duk_pop(state->ctx); // [websocket]
|
||||
|
||||
|
||||
ILibDuktape_DeleteReadOnlyProperty(state->ctx, -1, "decoded");
|
||||
ILibDuktape_DeleteReadOnlyProperty(state->ctx, -1, "encoded");
|
||||
|
||||
Reference in New Issue
Block a user