1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-20 18:23:21 +00:00

1. Fixed compiler warnings

2. Fixed crash that occurs if db is locked
This commit is contained in:
Bryan Roe
2020-04-11 13:06:53 -07:00
parent c4aba77b89
commit 893ec386a6
3 changed files with 14 additions and 9 deletions

View File

@@ -832,7 +832,7 @@ void* kvm_server_mainloop(void* parm)
Window rr, cr; Window rr, cr;
int rx, ry, wx, wy, rs; int rx, ry, wx, wy, rs;
unsigned int mr; unsigned int mr;
char *cursor_image = NULL,*cimage; char *cimage;
int x, y, height, width, r, c, count = 0; int x, y, height, width, r, c, count = 0;
int sentHideCursor = 0; int sentHideCursor = 0;

View File

@@ -331,11 +331,11 @@ int getTileAt(int x, int y, void** buffer, long long *bufferSize, void *desktop,
} }
int retval = 0; int retval = 0;
int firstTime = 1;
#if MAX_TILE_SIZE == 0 #if MAX_TILE_SIZE == 0
retval = calc_opt_compr_send(x, y, captureWidth, captureHeight, desktop, desktopsize, buffer, bufferSize); retval = calc_opt_compr_send(x, y, captureWidth, captureHeight, desktop, desktopsize, buffer, bufferSize);
#else #else
int firstTime = 1;
//This loop is used to adjust the COMPRESSION_RATIO. This loop runs only once most of the time. //This loop is used to adjust the COMPRESSION_RATIO. This loop runs only once most of the time.
do { do {
//retval here is 0 if everything was good. It is > 0 if it contains the size of the jpeg that was created and not sent. //retval here is 0 if everything was good. It is > 0 if it contains the size of the jpeg that was created and not sent.

View File

@@ -3801,17 +3801,22 @@ void MeshAgent_AgentMode_IPAddressChanged_Handler(ILibIPAddressMonitor sender, v
} }
int MeshAgent_AgentMode(MeshAgentHostContainer *agentHost, int paramLen, char **param, int parseCommands); int MeshAgent_AgentMode(MeshAgentHostContainer *agentHost, int paramLen, char **param, int parseCommands);
void MeshAgent_AgentMost_dbRetryAbort(void *object)
{
ILibMemory_Free(object);
}
void MeshAgent_AgentMost_dbRetryCallback(void *object) void MeshAgent_AgentMost_dbRetryCallback(void *object)
{ {
MeshAgentHostContainer *agentHost = (MeshAgentHostContainer*)((void**)object)[0]; MeshAgentHostContainer *agentHost = (MeshAgentHostContainer*)((void**)object)[0];
int paramLen = ((int*)&((void**)object)[1])[0]; int paramLen = (int)(uintptr_t)((void**)object)[1];
char **param = (char**)((void**)object)[2]; char **param = (char**)((void**)object)[2];
int parseCommands = ((int*)&((void**)object)[3])[0]; int parseCommands = (int)(uintptr_t)((void**)object)[3];
if (MeshAgent_AgentMode(agentHost, paramLen, param, parseCommands) == 0) if (MeshAgent_AgentMode(agentHost, paramLen, param, parseCommands) == 0)
{ {
ILibStopChain(agentHost->chain); ILibStopChain(agentHost->chain);
} }
ILibMemory_Free(object);
} }
void MeshAgent_AgentMode_Core_ServerTimeout(duk_context *ctx, void ** args, int argsLen) void MeshAgent_AgentMode_Core_ServerTimeout(duk_context *ctx, void ** args, int argsLen)
@@ -4001,11 +4006,11 @@ int MeshAgent_AgentMode(MeshAgentHostContainer *agentHost, int paramLen, char **
{ {
if (agentHost->masterDb == NULL) if (agentHost->masterDb == NULL)
{ {
void **data = (void**)ILibScratchPad; void **data = (void**)ILibMemory_SmartAllocate(4 * sizeof(void*));
data[0] = agentHost; data[0] = agentHost;
((int*)&(data[1]))[0] = paramLen; data[1] = (void*)(uintptr_t)paramLen;
data[2] = param; data[2] = param;
((int*)&(data[3]))[0] = parseCommands; data[3] = (void*)(uintptr_t)parseCommands;
switch (agentHost->dbRetryCount) switch (agentHost->dbRetryCount)
{ {
@@ -4015,7 +4020,7 @@ int MeshAgent_AgentMode(MeshAgentHostContainer *agentHost, int paramLen, char **
default: default:
printf("Unable to open database (%d/10)...\r\n", agentHost->dbRetryCount + 1); printf("Unable to open database (%d/10)...\r\n", agentHost->dbRetryCount + 1);
agentHost->dbRetryCount++; agentHost->dbRetryCount++;
ILibLifeTime_AddEx(ILibGetBaseTimer(agentHost->chain), data, 2000, MeshAgent_AgentMost_dbRetryCallback, NULL); ILibLifeTime_AddEx(ILibGetBaseTimer(agentHost->chain), data, 2000, MeshAgent_AgentMost_dbRetryCallback, MeshAgent_AgentMost_dbRetryAbort);
return 1; return 1;
} }
} }