File tree Expand file tree Collapse file tree 3 files changed +19
-10
lines changed Expand file tree Collapse file tree 3 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,12 @@ void ArbitratedClientManager::performClientRequest(RequestContext &request)
87
87
request.getCodec ()->updateStatus (err);
88
88
}
89
89
90
+ if (token != 0 )
91
+ {
92
+ // Also if status bad, need to free the token.
93
+ m_arbitrator->removePendingClient (token);
94
+ }
95
+
90
96
#if ERPC_MESSAGE_LOGGING
91
97
if (request.getCodec ()->isStatusOk () == true )
92
98
{
Original file line number Diff line number Diff line change @@ -193,8 +193,6 @@ erpc_status_t TransportArbitrator::clientReceive(client_token_t token)
193
193
// Wait on the semaphore until we're signaled.
194
194
info->m_sem .get (Semaphore::kWaitForever );
195
195
196
- removePendingClient (info);
197
-
198
196
return kErpcStatus_Success ;
199
197
}
200
198
@@ -227,11 +225,16 @@ TransportArbitrator::PendingClientInfo *TransportArbitrator::addPendingClient(vo
227
225
return info;
228
226
}
229
227
230
- void TransportArbitrator::removePendingClient (PendingClientInfo *info )
228
+ void TransportArbitrator::removePendingClient (client_token_t token )
231
229
{
230
+ // Convert token to pointer to info struct.
231
+ PendingClientInfo *info = reinterpret_cast <PendingClientInfo *>(token);
232
232
Mutex::Guard lock (m_clientListMutex);
233
233
PendingClientInfo *node;
234
234
235
+ erpc_assert ((token != 0 ) && (" invalid client token" != NULL ));
236
+ erpc_assert ((info->m_sem .getCount () == 0 ) && (" Semaphore should be clean" != NULL ));
237
+
235
238
// Clear fields.
236
239
info->m_request = NULL ;
237
240
info->m_isValid = false ;
Original file line number Diff line number Diff line change @@ -157,6 +157,13 @@ class TransportArbitrator : public Transport
157
157
*/
158
158
erpc_status_t clientReceive (client_token_t token);
159
159
160
+ /* !
161
+ * @brief This function free client token.
162
+ *
163
+ * @param[in] token the client token to remove.
164
+ */
165
+ void removePendingClient (client_token_t token);
166
+
160
167
/* !
161
168
* @brief Request info for a client trying to receive a response.
162
169
*/
@@ -200,13 +207,6 @@ class TransportArbitrator : public Transport
200
207
*/
201
208
PendingClientInfo *addPendingClient (void );
202
209
203
- /* !
204
- * @brief This function removes pending client.
205
- *
206
- * @param[in] info Pending client info to remove.
207
- */
208
- void removePendingClient (PendingClientInfo *info);
209
-
210
210
/* !
211
211
* @brief This function removes pending client list.
212
212
*
You can’t perform that action at this time.
0 commit comments