- 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 */ /* private instance variables */
struct sMmsConnection { struct sMmsConnection {
Semaphore lastInvokeIdLock; Semaphore nextInvokeIdLock;
uint32_t lastInvokeId; uint32_t nextInvokeId;
Semaphore outstandingCallsLock; Semaphore outstandingCallsLock;
MmsOutstandingCall outstandingCalls; MmsOutstandingCall outstandingCalls;

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

Loading…
Cancel
Save