Skip to content

Commit

Permalink
Fixes preexec issue with multiple requests
Browse files Browse the repository at this point in the history
  • Loading branch information
palladia authored and JumpingYang001 committed Jul 23, 2018
1 parent c7e705e commit 9216a8c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Unix/base/messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -1850,8 +1850,8 @@ typedef struct _ExecPreexecReq
}
ExecPreexecReq;

#define ExecPreexecReq_New() \
__ExecPreexecReq_New(0, 0, CALLSITE)
#define ExecPreexecReq_New(operationId) \
__ExecPreexecReq_New(operationId, 0, CALLSITE)


MI_INLINE ExecPreexecReq* __ExecPreexecReq_New(
Expand Down Expand Up @@ -1894,8 +1894,8 @@ typedef struct _ExecPreexecResp
}
ExecPreexecResp;

#define ExecPreexecResp_New() \
__ExecPreexecResp_New(0, 0, CALLSITE)
#define ExecPreexecResp_New(operationId) \
__ExecPreexecResp_New(operationId, 0, CALLSITE)


MI_INLINE ExecPreexecResp* __ExecPreexecResp_New(
Expand Down
2 changes: 1 addition & 1 deletion Unix/disp/agentmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1573,7 +1573,7 @@ static MI_Result _AgentMgr_ProcessPreExec(

Strand_Init(STRAND_DEBUG(AgentPreExecRequest) &preexecContext->requestStrand, &AgentPreExec_RequestStrand_FT, 0, params);

if (!SendExecutePreexecRequest(preexecContext, _AgentMgr_PreExecFinished, uid, gid, proventry->nameSpace, proventry->className))
if (!SendExecutePreexecRequest(preexecContext, _AgentMgr_PreExecFinished, uid, gid, proventry->nameSpace, proventry->className, _NextOperationId()))
{
return MI_RESULT_FAILED;
}
Expand Down
10 changes: 6 additions & 4 deletions Unix/protocol/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,8 @@ MI_Boolean SendExecutePreexecRequest(
uid_t uid,
gid_t gid,
const ZChar *nameSpace,
const ZChar *className
const ZChar *className,
MI_Uint64 operationId
)
{
ExecPreexecReq *req = NULL;
Expand All @@ -1509,7 +1510,7 @@ MI_Boolean SendExecutePreexecRequest(
preexecCtx->context = contextp;
preexecCtx->completion = completion;

req = ExecPreexecReq_New();
req = ExecPreexecReq_New(operationId);
if (!req)
{
PAL_Free(preexecCtx);
Expand Down Expand Up @@ -1561,14 +1562,15 @@ MI_Boolean SendExecutePreexecRequest(
/* Creates and sends ExecPreexecResp request message */
MI_Boolean SendExecutePreexecResponse(
void *contextp,
int retval
int retval,
MI_Uint64 operationId
)
{
ExecPreexecResp *req = NULL;
MI_Boolean retVal = MI_TRUE;
ProtocolSocket *protocolSocket = s_permanentSocket;

req = ExecPreexecResp_New();
req = ExecPreexecResp_New(operationId);
if (!req)
{
return MI_FALSE;
Expand Down
6 changes: 4 additions & 2 deletions Unix/protocol/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,13 @@ MI_Boolean SendExecutePreexecRequest(
uid_t uid,
gid_t gid,
const ZChar *nameSpace,
const ZChar *className);
const ZChar *className,
MI_Uint64 operationId);

MI_Boolean SendExecutePreexecResponse(
void *contextp,
int retval);
int retval,
MI_Uint64 operationId);

MI_Result Protocol_New_Agent_Request(
ProtocolSocketAndBase** selfOut,
Expand Down
2 changes: 1 addition & 1 deletion Unix/server/servercommon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ static MI_Boolean _ProcessExecPreexecReq(
trace_PreExecFailed(preexec);
}

ret = SendExecutePreexecResponse(contextp, r);
ret = SendExecutePreexecResponse(contextp, r, msg->operationId);

return ret;
}
Expand Down

0 comments on commit 9216a8c

Please sign in to comment.