- MMS client: fixed potential problem in handling of next invoke ID

pull/244/head
Michael Zillgith 5 years ago
parent fe2e5d59fd
commit 2ae8ea3844

@ -90,8 +90,8 @@ struct sMmsOutstandingCall
/* private instance variables */
struct sMmsConnection {
Semaphore lastInvokeIdLock;
uint32_t lastInvokeId;
Semaphore nextInvokeIdLock;
uint32_t nextInvokeId;
Semaphore outstandingCallsLock;
MmsOutstandingCall outstandingCalls;

@ -240,10 +240,10 @@ getNextInvokeId(MmsConnection self)
{
uint32_t nextInvokeId;
Semaphore_wait(self->lastInvokeIdLock);
self->lastInvokeId++;
nextInvokeId = self->lastInvokeId;
Semaphore_post(self->lastInvokeIdLock);
Semaphore_wait(self->nextInvokeIdLock);
self->nextInvokeId++;
nextInvokeId = self->nextInvokeId;
Semaphore_post(self->nextInvokeIdLock);
return nextInvokeId;
}
@ -1353,8 +1353,6 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload)
hasInvokeId = true;
self->lastInvokeId = invokeId;
break;
default:
@ -1429,7 +1427,7 @@ MmsConnection_createInternal(TLSConfiguration tlsConfig, bool createThread)
self->requestTimeout = CONFIG_MMS_CONNECTION_DEFAULT_TIMEOUT;
self->lastInvokeIdLock = Semaphore_create(1);
self->nextInvokeIdLock = Semaphore_create(1);
self->outstandingCallsLock = Semaphore_create(1);
self->associationStateLock = Semaphore_create(1);
@ -1512,7 +1510,7 @@ MmsConnection_destroy(MmsConnection self)
if (self->isoParameters != NULL)
IsoConnectionParameters_destroy(self->isoParameters);
Semaphore_destroy(self->lastInvokeIdLock);
Semaphore_destroy(self->nextInvokeIdLock);
Semaphore_destroy(self->outstandingCallsLock);

Loading…
Cancel
Save