static void recvReplyMessage (DISPATCH_PTR dispatch) { dispatchUpdateAndDisplay(HandledDispatch, dispatch); resourceRemoveAttending(dispatch); /* Added for safety, the dispatch message could have been * freed if there was an error. */ if ((dispatch->msg == NULL) || (dispatch->msg->msgData == NULL)) return; if (dispatch->msg->msgData->msg_class != MultiQueryClass || MULTI_QUERY_MAX(dispatch) > 0) { deliverResponse(dispatch); tapAfterReplied(dispatch); tapAfterHandled(dispatch); } #ifndef NMP_IPC if (dispatch->msg->msgData->msg_class == MultiQueryClass) { multiQueryUpdate(dispatch, TRUE); } #endif /* 31-Oct-90: fedor: problem with replies that are not simply replies to standard query messages ...etc. sooo we need to keep the dispatch around but perhaps not the datamsg. This just postpones the eventual memory lossage */ x_ipc_dataMsgFree(dispatch->msgData); x_ipc_dataMsgFree(dispatch->resData); dispatch->msgData = NULL; dispatch->resData = NULL; /* 31-Oct-90: fedor: also need to do free before processing further otherwise we may loop and never free anything */ resourceProcessPending(dispatch); /* 02-Jul-91: reid: Centrally handled dispatch queries are * freed in "processResAttendDeliver" */ if (dispatch->des != GET_S_GLOBAL(x_ipcServerModGlobal)) dispatchFree(dispatch); }
void processHandledMessage(DISPATCH_PTR dispatch) { dispatchUpdateAndDisplay(HandledDispatch, dispatch); resourceRemoveAttending(dispatch); tapAfterHandled(dispatch); if (dispatch->msg && !ONE_WAY_MSG(dispatch->msg)) { switch (dispatch->msg_class) { case SuccessClass: #ifndef NMP_IPC tapWhenSuccess(dispatch); tapAfterSuccess(dispatch); #endif break; #ifndef NMP_IPC case FailureClass: tapWhenFailure(dispatch); tapAfterFailure(dispatch); break; #endif default: /* X_IPC_MOD_ERROR("Unhandled default"); */ X_IPC_MOD_WARNING1("unhandled default in processHandledMessage %d\n", dispatch->msg_class); break; } } resourceProcessPending(dispatch); #ifndef NMP_IPC CompletionConstraints(dispatch); HandleKillAfterAttendingNodes(dispatch); #endif if (!dispatch->msg || ONE_WAY_MSG(dispatch->msg)) dispatchFree(dispatch); /* 14-May-91: fedor: exception class messages that are byPassed or retry should not be dispatch freed arbitrarly - may need to declare the first message handled and then resend the same dispatch through recvMessage */ }