diff --git a/src/source/Ice/IceAgent.c b/src/source/Ice/IceAgent.c index fde9db6394..f917667233 100644 --- a/src/source/Ice/IceAgent.c +++ b/src/source/Ice/IceAgent.c @@ -64,8 +64,8 @@ STATUS createIceAgent(PCHAR username, PCHAR password, PIceAgentCallbacks pIceAge pIceAgent->lock = MUTEX_CREATE(TRUE); // Create the state machine - CHK_STATUS(createStateMachine(ICE_AGENT_STATE_MACHINE_STATES, ICE_AGENT_STATE_MACHINE_STATE_COUNT, (UINT64) pIceAgent, iceAgentGetCurrentTime, - (UINT64) pIceAgent, &pIceAgent->pStateMachine)); + CHK_STATUS(createStateMachineWithName(ICE_AGENT_STATE_MACHINE_STATES, ICE_AGENT_STATE_MACHINE_STATE_COUNT, (UINT64) pIceAgent, + iceAgentGetCurrentTime, (UINT64) pIceAgent, ICE_STATE_MACHINE_NAME, &pIceAgent->pStateMachine)); pIceAgent->iceAgentStatus = STATUS_SUCCESS; pIceAgent->iceAgentStateTimerTask = MAX_UINT32; pIceAgent->keepAliveTimerTask = MAX_UINT32; diff --git a/src/source/Ice/IceAgent.h b/src/source/Ice/IceAgent.h index a2027f87ca..f6e1a59852 100644 --- a/src/source/Ice/IceAgent.h +++ b/src/source/Ice/IceAgent.h @@ -56,6 +56,9 @@ extern "C" { #define ICE_CANDIDATE_ID_LEN 8 #define STATS_NOT_APPLICABLE_STR (PCHAR) "N/A" + +#define ICE_STATE_MACHINE_NAME (PCHAR) "ICE" + typedef enum { ICE_CANDIDATE_STATE_NEW, ICE_CANDIDATE_STATE_VALID, diff --git a/src/source/Ice/TurnConnection.c b/src/source/Ice/TurnConnection.c index cea3e559aa..53459a9790 100644 --- a/src/source/Ice/TurnConnection.c +++ b/src/source/Ice/TurnConnection.c @@ -15,6 +15,7 @@ STATUS createTurnConnection(PIceServer pTurnServer, TIMER_QUEUE_HANDLE timerQueu ENTERS(); STATUS retStatus = STATUS_SUCCESS; PTurnConnection pTurnConnection = NULL; + CHAR turnStateMachineName[MAX_STATE_MACHINE_NAME_LENGTH]; CHK(pTurnServer != NULL && ppTurnConnection != NULL && pTurnSocket != NULL, STATUS_NULL_ARG); CHK(IS_VALID_TIMER_QUEUE_HANDLE(timerQueueHandle), STATUS_INVALID_ARG); @@ -62,8 +63,9 @@ STATUS createTurnConnection(PIceServer pTurnServer, TIMER_QUEUE_HANDLE timerQueu pTurnConnection->nextAllocationRefreshTime = 0; pTurnConnection->currentTimerCallingPeriod = DEFAULT_TURN_TIMER_INTERVAL_BEFORE_READY; - CHK_STATUS(createStateMachine(TURN_CONNECTION_STATE_MACHINE_STATES, TURN_CONNECTION_STATE_MACHINE_STATE_COUNT, (UINT64) pTurnConnection, - turnConnectionGetTime, (UINT64) pTurnConnection, &pTurnConnection->pStateMachine)); + SNPRINTF(turnStateMachineName, MAX_STATE_MACHINE_NAME_LENGTH, "%s-%p", TURN_STATE_MACHINE_NAME, (PVOID) pTurnConnection); + CHK_STATUS(createStateMachineWithName(TURN_CONNECTION_STATE_MACHINE_STATES, TURN_CONNECTION_STATE_MACHINE_STATE_COUNT, (UINT64) pTurnConnection, + turnConnectionGetTime, (UINT64) pTurnConnection, turnStateMachineName, &pTurnConnection->pStateMachine)); CleanUp: diff --git a/src/source/Ice/TurnConnection.h b/src/source/Ice/TurnConnection.h index ab69a3c668..4e9d8d6bdc 100644 --- a/src/source/Ice/TurnConnection.h +++ b/src/source/Ice/TurnConnection.h @@ -46,6 +46,8 @@ extern "C" { #define TURN_DATA_CHANNEL_SEND_OVERHEAD 4 #define TURN_DATA_CHANNEL_MSG_FIRST_BYTE 0x40 +#define TURN_STATE_MACHINE_NAME (PCHAR) "TURN" + #define TURN_STATE_NEW_STR (PCHAR) "TURN_STATE_NEW" #define TURN_STATE_CHECK_SOCKET_CONNECTION_STR (PCHAR) "TURN_STATE_CHECK_SOCKET_CONNECTION" #define TURN_STATE_GET_CREDENTIALS_STR (PCHAR) "TURN_STATE_GET_CREDENTIALS" diff --git a/src/source/Ice/TurnConnectionStateMachine.c b/src/source/Ice/TurnConnectionStateMachine.c index 268ce1da2d..0a7dfd82d5 100644 --- a/src/source/Ice/TurnConnectionStateMachine.c +++ b/src/source/Ice/TurnConnectionStateMachine.c @@ -129,7 +129,7 @@ STATUS stepTurnConnectionStateMachine(PTurnConnection pTurnConnection) } if (oldState != pTurnConnection->state) { - DLOGD("Turn connection state changed from %s to %s.", turnConnectionGetStateStr(oldState), + DLOGD("[%p] Turn connection state changed from %s to %s.", (PVOID) pTurnConnection, turnConnectionGetStateStr(oldState), turnConnectionGetStateStr(pTurnConnection->state)); } else { // state machine retry is not used. resetStateMachineRetryCount just to avoid diff --git a/src/source/Signaling/Signaling.c b/src/source/Signaling/Signaling.c index 7b7a312a72..7b9d2d1f39 100644 --- a/src/source/Signaling/Signaling.c +++ b/src/source/Signaling/Signaling.c @@ -91,9 +91,10 @@ STATUS createSignalingSync(PSignalingClientInfoInternal pClientInfo, PChannelInf CHK_STATUS(configureRetryStrategyForSignalingStateMachine(pSignalingClient)); // Create the state machine - CHK_STATUS(createStateMachine(SIGNALING_STATE_MACHINE_STATES, SIGNALING_STATE_MACHINE_STATE_COUNT, - CUSTOM_DATA_FROM_SIGNALING_CLIENT(pSignalingClient), signalingGetCurrentTime, - CUSTOM_DATA_FROM_SIGNALING_CLIENT(pSignalingClient), &pSignalingClient->pStateMachine)); + CHK_STATUS(createStateMachineWithName(SIGNALING_STATE_MACHINE_STATES, SIGNALING_STATE_MACHINE_STATE_COUNT, + CUSTOM_DATA_FROM_SIGNALING_CLIENT(pSignalingClient), signalingGetCurrentTime, + CUSTOM_DATA_FROM_SIGNALING_CLIENT(pSignalingClient), SIGNALING_STATE_MACHINE_NAME, + &pSignalingClient->pStateMachine)); // Prepare the signaling channel protocols array pSignalingClient->signalingProtocols[PROTOCOL_INDEX_HTTPS].name = HTTPS_SCHEME_NAME; diff --git a/src/source/Signaling/Signaling.h b/src/source/Signaling/Signaling.h index 10d2813255..5b2802d74a 100644 --- a/src/source/Signaling/Signaling.h +++ b/src/source/Signaling/Signaling.h @@ -89,6 +89,8 @@ extern "C" { #define DEFAULT_CREATE_SIGNALING_CLIENT_RETRY_ATTEMPTS 7 +#define SIGNALING_STATE_MACHINE_NAME (PCHAR) "SIGNALING" + static const ExponentialBackoffRetryStrategyConfig DEFAULT_SIGNALING_STATE_MACHINE_EXPONENTIAL_BACKOFF_RETRY_CONFIGURATION = { /* Exponential wait times with this config will look like following - ************************************