- client now closes the TCP connection if server doesn't close the connection after receiveing the abort message.
This commit is contained in:
parent
1a95580f94
commit
30a64e2914
4 changed files with 23 additions and 8 deletions
|
@ -188,10 +188,10 @@ MmsConnection_close(MmsConnection self);
|
|||
/**
|
||||
* \brief Uses the MMS/ACSE abort service to close the connection to the server
|
||||
*
|
||||
* This service should be used to abruptly interrupt the connection to the server. The TCP connection will
|
||||
* be closed immediately after sending the ACSE abort message to the server. It is not quite clear what the
|
||||
* This service should be used to abruptly interrupt the connection to the server. It is not quite clear what the
|
||||
* benefit of this service is (simply closing the TCP connection should do the same). Though it is required by
|
||||
* conformance tests.
|
||||
* conformance tests. In case the server doesn't close the connection after the internal timeout interval the
|
||||
* client will close the TCP connection and set mmsError to MMS_ERROR_SERVICE_TIMEOUT.
|
||||
*
|
||||
* \param self MmsConnection instance to operate on
|
||||
* \param mmsError user provided variable to store error code
|
||||
|
|
|
@ -67,7 +67,12 @@ IsoClientConnection_sendMessage(IsoClientConnection self, ByteBuffer* payload);
|
|||
void
|
||||
IsoClientConnection_release(IsoClientConnection self);
|
||||
|
||||
void
|
||||
/**
|
||||
* \brief Send ACSE abort message and wait until connection is closed by server or timeout occured
|
||||
*
|
||||
* \return true if abort has been successful, false indicates a timeout
|
||||
*/
|
||||
bool
|
||||
IsoClientConnection_abort(IsoClientConnection self);
|
||||
|
||||
void
|
||||
|
|
|
@ -498,7 +498,7 @@ IsoClientConnection_destroy(IsoClientConnection self)
|
|||
GLOBAL_FREEMEM(self);
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
IsoClientConnection_abort(IsoClientConnection self)
|
||||
{
|
||||
//TODO block other messages from being sent
|
||||
|
@ -535,6 +535,11 @@ IsoClientConnection_abort(IsoClientConnection self)
|
|||
uint64_t timeout = Hal_getTimeInMs() + CONFIG_TCP_READ_TIMEOUT_MS;
|
||||
|
||||
while ((self->handlingThreadRunning == true) && (Hal_getTimeInMs() < timeout));
|
||||
|
||||
if (self->handlingThreadRunning)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -925,10 +925,15 @@ MmsConnection_abort(MmsConnection self, MmsError* mmsError)
|
|||
|
||||
self->connectionLostHandler = NULL;
|
||||
|
||||
if (self->associationState == MMS_STATE_CONNECTED)
|
||||
IsoClientConnection_abort(self->isoClient);
|
||||
bool success = true;
|
||||
|
||||
//TODO wait for connection to be closed
|
||||
if (self->associationState == MMS_STATE_CONNECTED)
|
||||
success = IsoClientConnection_abort(self->isoClient);
|
||||
|
||||
if (success == false) {
|
||||
IsoClientConnection_close(self->isoClient);
|
||||
*mmsError = MMS_ERROR_SERVICE_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Add table
Reference in a new issue