541 aa->SetError(errmsg.iValue); |
541 aa->SetError(errmsg.iValue); |
542 aa->SetIdle(); |
542 aa->SetIdle(); |
543 return; |
543 return; |
544 } |
544 } |
545 |
545 |
546 //Determine who TErrorRecoveryRequest should be sent to. |
|
547 //If there is no ControlProvider we send a RecoveryRequest to ourselves to recover from the error, |
|
548 //otherwise we sned the RecoveryRequest up to our ControlProvider. |
|
549 //MCPrs typically put all of the error recovery function in a single error recovery activity therefore |
|
550 //it makes sense even for MCPrs to send TErrorRecoveryRequest to their error recovery function. By |
|
551 //posting a TErrorRecoveryRequest sub-classes of the MCPrs get a chance to override the default error |
|
552 //recovery. |
|
553 RNodeInterface* errorRecoverer = iContext.Node().ControlProvider() ? iContext.Node().ControlProvider() : &iContext.Node().SelfInterface(); |
|
554 |
|
555 __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KCorePrPanic, KPanicNoActivity)); |
546 __ASSERT_DEBUG(iContext.iNodeActivity, User::Panic(KCorePrPanic, KPanicNoActivity)); |
556 CoreActivities::CErrorActivity& activity = static_cast<CoreActivities::CErrorActivity&>(*iContext.iNodeActivity); |
547 CoreActivities::CErrorActivity& activity = static_cast<CoreActivities::CErrorActivity&>(*iContext.iNodeActivity); |
557 __ASSERT_DEBUG(activity.iErroredActivityId==MeshMachine::KActivityNull, User::Panic(KSpecAssert_ESockCrStaCPRAC, 4)); |
548 __ASSERT_DEBUG(activity.iErroredActivityId==MeshMachine::KActivityNull, User::Panic(KSpecAssert_ESockCrStaCPRAC, 4)); |
558 // Save a reference to the activity and a point |
549 // Save a reference to the activity and a point |
559 // Each time we use the activity, query it from the node, because the activity may have gone away (originator left node etc) |
550 // Each time we use the activity, query it from the node, because the activity may have gone away (originator left node etc) |
564 |
555 |
565 TErrContext ctx(iContext.NodeId(), errmsg.iMsgId, aa->ActivitySigId(), TStateChange(0, errmsg.iValue)); |
556 TErrContext ctx(iContext.NodeId(), errmsg.iMsgId, aa->ActivitySigId(), TStateChange(0, errmsg.iValue)); |
566 TEErrorRecovery::TErrorRecoveryRequest msg(ctx); |
557 TEErrorRecovery::TErrorRecoveryRequest msg(ctx); |
567 |
558 |
568 activity.PostRequestTo( |
559 activity.PostRequestTo( |
569 *errorRecoverer,//ControlProvider() verified above |
560 *iContext.Node().ControlProvider(),//ControlProvider() verified above |
570 TCFSafeMessage::TRequestCarrierEast<TEErrorRecovery::TErrorRecoveryRequest>(msg).CRef() |
561 TCFSafeMessage::TRequestCarrierEast<TEErrorRecovery::TErrorRecoveryRequest>(msg).CRef() |
571 ); |
562 ); |
572 |
563 |
573 //The original activiy might have set 'sent to', but that's surely |
564 //The original activiy might have set 'sent to', but that's surely |
574 //not meaningful anymore (we've just received a response from that 'sent to'). |
565 //not meaningful anymore (we've just received a response from that 'sent to'). |