From: Michael Chase-S. <mc...@us...> - 2012-02-24 23:12:14
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "SFCB - Small Footprint CIM Broker". The branch, master has been updated via 91be3529cd5467d83df93caba18d9b3694175908 (commit) via fcb41dfc9a13fdcc7840747fbde20d507e46d603 (commit) from aa547cbd23a10c9adffbed6782cd34da76b245d6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 91be3529cd5467d83df93caba18d9b3694175908 Author: Michael Chase-Salerno <br...@li...> Date: Fri Feb 24 18:11:57 2012 -0500 3484025 Disable indication sequencing commit fcb41dfc9a13fdcc7840747fbde20d507e46d603 Author: Michael Chase-Salerno <br...@li...> Date: Fri Feb 24 18:09:08 2012 -0500 3484025 Disable indication sequencing ----------------------------------------------------------------------- Summary of changes: diff --git a/ChangeLog b/ChangeLog index cfc8130..1d2ffa8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-02-24 Michael Chase-Salerno <br...@li...> + + * interopProvider.c, indCIMXMLHandler.c, sfcb.cfg.pre.in + [ 3484025 ] Disable indication sequencing + 2012-01-26 Michael Chase-Salerno <br...@li...> * interopProvider.c, indCIMXMLHandler.c, indRetryTest.sh diff --git a/indCIMXMLHandler.c b/indCIMXMLHandler.c index ba7bbdc..3a827fe 100644 --- a/indCIMXMLHandler.c +++ b/indCIMXMLHandler.c @@ -62,6 +62,8 @@ interOpNameSpace(const CMPIObjectPath * cop, CMPIStatus *st) return 1; } +int RIEnabled=-1; + /* * ------------------------------------------------------------------ * * Instance MI Cleanup @@ -420,6 +422,8 @@ IndCIMXMLHandlerCreateInstance(CMPIInstanceMI * mi, strftime(gtime, 15, "%Y%m%d%H%M%S", &cttm); } + // Even though reliable indications may be disabled, we need to do this + // in case it ever gets enabled. // Get the IndicationService name CMPIObjectPath * isop = CMNewObjectPath(_broker, "root/interop", "CIM_IndicationService", NULL); CMPIEnumeration * isenm = _broker->bft->enumerateInstances(_broker, ctx, isop, NULL, NULL); @@ -953,55 +957,60 @@ IndCIMXMLHandlerInvokeMethod(CMPIMethodMI * mi, if (strcasecmp(methodName, "_deliver") == 0) { - // Set the indication sequence values + // On the first indication, check if reliable indications are enabled. + if (RIEnabled == -1) { + CMPIObjectPath *op=CMNewObjectPath(_broker,"root/interop","CIM_IndicationService",NULL); + CMPIEnumeration *isenm = _broker->bft->enumerateInstances(_broker, ctx, op, NULL, NULL); + CMPIData isinst=CMGetNext(isenm,NULL); + CMPIData mc=CMGetProperty(isinst.value.inst,"DeliveryRetryAttempts",NULL); + RIEnabled=mc.value.uint16; + } + CMPIInstance *indo=CMGetArg(in,"indication",NULL).value.inst; CMPIInstance *ind=CMClone(indo,NULL); - CMPIObjectPath * iop=CMGetObjectPath(ind,NULL); - CMPIInstance *sub=CMGetArg(in,"subscription",NULL).value.inst; - CMPIObjectPath * subop=CMGetObjectPath(sub,NULL); - CMPIData handler=CMGetProperty(sub, "Handler", &st); - CMPIObjectPath *hop=handler.value.ref; - CMPIContext *ctxLocal = prepareUpcall((CMPIContext *) ctx); - CMPIInstance *hdlr=CBGetInstance(_broker, ctxLocal, hop, NULL, &st); - CMAddKey(iop,"SFCB_IndicationID",&indID,CMPI_uint32); - CMSetProperty(ind,"SFCB_IndicationID",&indID,CMPI_uint32); - - // Build the complete sequence context - // Get the stub from the handler - CMPIString *context = CMGetProperty(hdlr, "SequenceContext", &st).value.string; - // and add the sfcb start time - char *cstr=malloc( (strlen(context->ft->getCharPtr(context,NULL)) + strlen(sfcBrokerStart) + 1) * sizeof(char)); - sprintf(cstr,"%s%s",context->ft->getCharPtr(context,NULL),sfcBrokerStart); - context = sfcb_native_new_CMPIString(cstr, NULL, 0); - // and put it in the indication - CMSetProperty(ind, "SequenceContext", &context, CMPI_string); - free(cstr); - CMRelease(context); - - // Get the proper sequence number - CMPIValue lastseq = CMGetProperty(hdlr, "LastSequenceNumber", &st).value; - lastseq.sint64++; - // Handle wrapping of the signed int - if (lastseq.sint64 < 0) lastseq.sint64=0; - // Update the last used number in the handler - CMSetProperty(hdlr, "LastSequenceNumber", &lastseq.sint64, CMPI_sint64); - CBModifyInstance(_broker, ctxLocal, hop, hdlr, NULL); - // And the indication - CMSetProperty(ind, "SequenceNumber", &lastseq, CMPI_sint64); + CMPIContext *ctxLocal=NULL; + CMPIObjectPath *iop=NULL,*subop=NULL; + CMPIInstance *sub=NULL; + + if (RIEnabled) { + ctxLocal = prepareUpcall((CMPIContext *) ctx); + // Set the indication sequence values + iop=CMGetObjectPath(ind,NULL); + CMAddKey(iop,"SFCB_IndicationID",&indID,CMPI_uint32); + CMSetProperty(ind,"SFCB_IndicationID",&indID,CMPI_uint32); + sub=CMGetArg(in,"subscription",NULL).value.inst; + CMPIData handler=CMGetProperty(sub, "Handler", &st); + CMPIObjectPath *hop=handler.value.ref; + CMPIInstance *hdlr=CBGetInstance(_broker, ctxLocal, hop, NULL, &st); + + // Build the complete sequence context + // Get the stub from the handler + CMPIString *context = CMGetProperty(hdlr, "SequenceContext", &st).value.string; + // and add the sfcb start time + char *cstr=malloc( (strlen(context->ft->getCharPtr(context,NULL)) + strlen(sfcBrokerStart) + 1) * sizeof(char)); + sprintf(cstr,"%s%s",context->ft->getCharPtr(context,NULL),sfcBrokerStart); + context = sfcb_native_new_CMPIString(cstr, NULL, 0); + // and put it in the indication + CMSetProperty(ind, "SequenceContext", &context, CMPI_string); + free(cstr); + CMRelease(context); + + // Get the proper sequence number + CMPIValue lastseq = CMGetProperty(hdlr, "LastSequenceNumber", &st).value; + lastseq.sint64++; + // Handle wrapping of the signed int + if (lastseq.sint64 < 0) lastseq.sint64=0; + // Update the last used number in the handler + CMSetProperty(hdlr, "LastSequenceNumber", &lastseq.sint64, CMPI_sint64); + CBModifyInstance(_broker, ctxLocal, hop, hdlr, NULL); + // And the indication + CMSetProperty(ind, "SequenceNumber", &lastseq, CMPI_sint64); + } // Now send the indication st = deliverInd(ref, in, ind); if (st.rc != 0) { - // Get the retry params from IndService - CMPIObjectPath *op = - CMNewObjectPath(_broker, "root/interop", "CIM_IndicationService", - NULL); - CMPIEnumeration *isenm = - _broker->bft->enumerateInstances(_broker, ctx, op, NULL, NULL); - CMPIData isinst = CMGetNext(isenm, NULL); - CMPIData mc = - CMGetProperty(isinst.value.inst, "DeliveryRetryAttempts", NULL); - if (mc.value.uint16 > 0) { + if (RIEnabled){ _SFCB_TRACE(1,("--- Indication delivery failed, adding to retry queue")); // Indication delivery failed, send to retry queue // build an element @@ -1009,6 +1018,7 @@ IndCIMXMLHandlerInvokeMethod(CMPIMethodMI * mi, element = (RTElement *) malloc(sizeof(*element)); element->ref=ref->ft->clone(ref,NULL); // Get the OP of the subscription and indication + subop=CMGetObjectPath(sub,NULL); element->sub=subop->ft->clone(subop,NULL); element->ind=iop->ft->clone(iop,NULL); // Store other attrs @@ -1033,9 +1043,9 @@ IndCIMXMLHandlerInvokeMethod(CMPIMethodMI * mi, CMPIContext *pctx = native_clone_CMPIContext(ctx); pthread_create(&t, &tattr, &retryExport, (void *) pctx); } + CMRelease(ctxLocal); } } - CMRelease(ctxLocal); CMRelease(ind); } else { diff --git a/interopProvider.c b/interopProvider.c index 6e62a1a..cf6b94c 100644 --- a/interopProvider.c +++ b/interopProvider.c @@ -58,6 +58,7 @@ extern void memLinkObjectPath(CMPIObjectPath * op); static const CMPIBroker *_broker; static int firstTime = 1; +int RIEnabled=0; typedef struct filter { CMPIInstance *fci; @@ -731,6 +732,12 @@ initInterOp(const CMPIBroker * broker, const CMPIContext *ctx) CMRelease(enm); } + CMPIObjectPath *isop=CMNewObjectPath(broker,"root/interop","CIM_IndicationService",NULL); + CMPIEnumeration *isenm = broker->bft->enumerateInstances(broker, ctx, isop, NULL, NULL); + CMPIData isinst=CMGetNext(isenm,NULL); + CMPIData mc=CMGetProperty(isinst.value.inst,"DeliveryRetryAttempts",NULL); + int RIEnabled=mc.value.uint16; + _SFCB_TRACE(1, ("--- checking for cim_listenerdestination")); op = CMNewObjectPath(broker, "root/interop", "cim_listenerdestination", &st); @@ -740,11 +747,13 @@ initInterOp(const CMPIBroker * broker, const CMPIContext *ctx) while (enm->ft->hasNext(enm, &st) && (ci = (enm->ft->getNext(enm, &st)).value.inst)) { cop = CMGetObjectPath(ci, &st); - // Reset the sequence numbers on sfcb restart - CMPIInstance *ldi = _broker->bft->getInstance(_broker, ctxLocal, cop, NULL, NULL); - CMPIValue zarro = {.sint64 = -1 }; - CMSetProperty(ldi, "LastSequenceNumber", &zarro, CMPI_sint64); - CBModifyInstance(_broker, ctxLocal, cop, ldi, NULL); + if (RIEnabled) { + // Reset the sequence numbers on sfcb restart + CMPIInstance *ldi = _broker->bft->getInstance(_broker, ctxLocal, cop, NULL, NULL); + CMPIValue zarro = {.sint64 = -1 }; + CMSetProperty(ldi, "LastSequenceNumber", &zarro, CMPI_sint64); + CBModifyInstance(_broker, ctxLocal, cop, ldi, NULL); + } addHandler(ci, cop); } CMRelease(enm); diff --git a/sfcb.cfg.pre.in b/sfcb.cfg.pre.in index 20c69f7..ac4ad1f 100644 --- a/sfcb.cfg.pre.in +++ b/sfcb.cfg.pre.in @@ -257,6 +257,8 @@ sslCiphers: ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH ## Number of retry attempts before giving up ## Default is 3 attempts (not including initial attempt) ## A value of 0 disables reliable indications +## including indication sequence numbers and subscription +## removal. #DeliveryRetryAttempts: 3 ## The length of time an destination can fail before the subscription hooks/post-receive -- SFCB - Small Footprint CIM Broker |