File tree 3 files changed +12
-22
lines changed
3 files changed +12
-22
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,10 @@ void InteractionModelEngine::Shutdown()
132
132
133
133
for (auto & writeHandler : mWriteHandlers )
134
134
{
135
- writeHandler.Abort ();
135
+ if (!writeHandler.IsFree ())
136
+ {
137
+ writeHandler.Close ();
138
+ }
136
139
}
137
140
138
141
mReportingEngine .Shutdown ();
Original file line number Diff line number Diff line change @@ -48,15 +48,16 @@ CHIP_ERROR WriteHandler::Init()
48
48
49
49
void WriteHandler::Close ()
50
50
{
51
- mSuppressResponse = false ;
52
51
VerifyOrReturn (mState != State::Uninitialized);
53
52
54
- ClearState ();
55
- }
56
-
57
- void WriteHandler::Abort ()
58
- {
59
- ClearState ();
53
+ // DeliverFinalListWriteEnd will be a no-op if we have called
54
+ // DeliverFinalListWriteEnd in success conditions, so passing false for
55
+ // wasSuccessful here is safe: if it does anything, we were in fact not
56
+ // successful.
57
+ DeliverFinalListWriteEnd (false /* wasSuccessful */ );
58
+ mExchangeCtx .Release ();
59
+ mSuppressResponse = false ;
60
+ MoveToState (State::Uninitialized);
60
61
}
61
62
62
63
Status WriteHandler::HandleWriteRequestMessage (Messaging::ExchangeContext * apExchangeContext,
@@ -691,13 +692,6 @@ void WriteHandler::MoveToState(const State aTargetState)
691
692
ChipLogDetail (DataManagement, " IM WH moving to [%s]" , GetStateStr ());
692
693
}
693
694
694
- void WriteHandler::ClearState ()
695
- {
696
- DeliverFinalListWriteEnd (false /* wasSuccessful */ );
697
- mExchangeCtx .Release ();
698
- MoveToState (State::Uninitialized);
699
- }
700
-
701
695
} // namespace app
702
696
} // namespace chip
703
697
Original file line number Diff line number Diff line change @@ -70,12 +70,6 @@ class WriteHandler : public Messaging::ExchangeDelegate
70
70
Protocols::InteractionModel::Status OnWriteRequest (Messaging::ExchangeContext * apExchangeContext,
71
71
System::PacketBufferHandle && aPayload, bool aIsTimedWrite);
72
72
73
- /*
74
- * This forcibly closes the exchange context if a valid one is pointed to and de-initializes the object. Such a situation does
75
- * not arise during normal message processing flows that all normally call Close() below.
76
- */
77
- void Abort ();
78
-
79
73
/* *
80
74
* Clean up state when we are done sending the write response.
81
75
*/
@@ -136,7 +130,6 @@ class WriteHandler : public Messaging::ExchangeDelegate
136
130
CHIP_ERROR SendWriteResponse (System::PacketBufferTLVWriter && aMessageWriter);
137
131
138
132
void MoveToState (const State aTargetState);
139
- void ClearState ();
140
133
const char * GetStateStr () const ;
141
134
142
135
void DeliverListWriteBegin (const ConcreteAttributePath & aPath);
You can’t perform that action at this time.
0 commit comments