diff options
Diffstat (limited to 'toxav/msi.c')
-rw-r--r-- | toxav/msi.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/toxav/msi.c b/toxav/msi.c index 3a0577ae..999f86b6 100644 --- a/toxav/msi.c +++ b/toxav/msi.c | |||
@@ -1043,12 +1043,12 @@ MSICall *init_call ( MSISession *session, int peers, int ringing_timeout ) | |||
1043 | return NULL; | 1043 | return NULL; |
1044 | } | 1044 | } |
1045 | 1045 | ||
1046 | int32_t _call_idx = 0; | 1046 | int32_t call_idx = 0; |
1047 | 1047 | ||
1048 | for (; _call_idx < session->max_calls; _call_idx ++) { | 1048 | for (; call_idx < session->max_calls; call_idx ++) { |
1049 | if ( !session->calls[_call_idx] ) { | 1049 | if ( !session->calls[call_idx] ) { |
1050 | 1050 | ||
1051 | if (!(session->calls[_call_idx] = calloc ( sizeof ( MSICall ), 1 ))) { | 1051 | if (!(session->calls[call_idx] = calloc ( sizeof ( MSICall ), 1 ))) { |
1052 | LOGGER_WARNING("Allocation failed! Program might misbehave!"); | 1052 | LOGGER_WARNING("Allocation failed! Program might misbehave!"); |
1053 | return NULL; | 1053 | return NULL; |
1054 | } | 1054 | } |
@@ -1057,35 +1057,35 @@ MSICall *init_call ( MSISession *session, int peers, int ringing_timeout ) | |||
1057 | } | 1057 | } |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | if ( _call_idx == session->max_calls ) { | 1060 | if ( call_idx == session->max_calls ) { |
1061 | LOGGER_WARNING("Reached maximum amount of calls!"); | 1061 | LOGGER_WARNING("Reached maximum amount of calls!"); |
1062 | return NULL; | 1062 | return NULL; |
1063 | } | 1063 | } |
1064 | 1064 | ||
1065 | 1065 | ||
1066 | MSICall *_call = session->calls[_call_idx]; | 1066 | MSICall *call = session->calls[call_idx]; |
1067 | 1067 | ||
1068 | _call->call_idx = _call_idx; | 1068 | call->call_idx = call_idx; |
1069 | 1069 | ||
1070 | if ( !(_call->type_peer = calloc ( sizeof ( MSICallType ), peers )) ) { | 1070 | if ( !(call->type_peer = calloc ( sizeof ( MSICallType ), peers )) ) { |
1071 | LOGGER_WARNING("Allocation failed! Program might misbehave!"); | 1071 | LOGGER_WARNING("Allocation failed! Program might misbehave!"); |
1072 | free(_call); | 1072 | free(call); |
1073 | return NULL; | 1073 | return NULL; |
1074 | } | 1074 | } |
1075 | 1075 | ||
1076 | _call->session = session; | 1076 | call->session = session; |
1077 | 1077 | ||
1078 | /*_call->_participant_count = _peers;*/ | 1078 | /*_call->_participant_count = _peers;*/ |
1079 | 1079 | ||
1080 | _call->request_timer_id = 0; | 1080 | call->request_timer_id = 0; |
1081 | _call->ringing_timer_id = 0; | 1081 | call->ringing_timer_id = 0; |
1082 | 1082 | ||
1083 | _call->ringing_tout_ms = ringing_timeout; | 1083 | call->ringing_tout_ms = ringing_timeout; |
1084 | 1084 | ||
1085 | pthread_mutex_init ( &_call->mutex, NULL ); | 1085 | pthread_mutex_init ( &call->mutex, NULL ); |
1086 | 1086 | ||
1087 | LOGGER_DEBUG("Started new call with index: %u", _call_idx); | 1087 | LOGGER_DEBUG("Started new call with index: %u", call_idx); |
1088 | return _call; | 1088 | return call; |
1089 | } | 1089 | } |
1090 | 1090 | ||
1091 | 1091 | ||
@@ -1603,38 +1603,38 @@ MSISession *msi_init_session ( Messenger *messenger, int32_t max_calls ) | |||
1603 | return NULL; | 1603 | return NULL; |
1604 | } | 1604 | } |
1605 | 1605 | ||
1606 | MSISession *_retu = calloc ( sizeof ( MSISession ), 1 ); | 1606 | MSISession *retu = calloc ( sizeof ( MSISession ), 1 ); |
1607 | 1607 | ||
1608 | if (_retu == NULL) { | 1608 | if (retu == NULL) { |
1609 | LOGGER_ERROR("Allocation failed! Program might misbehave!"); | 1609 | LOGGER_ERROR("Allocation failed! Program might misbehave!"); |
1610 | return NULL; | 1610 | return NULL; |
1611 | } | 1611 | } |
1612 | 1612 | ||
1613 | _retu->messenger_handle = messenger; | 1613 | retu->messenger_handle = messenger; |
1614 | _retu->agent_handler = NULL; | 1614 | retu->agent_handler = NULL; |
1615 | _retu->timer_handler = handler; | 1615 | retu->timer_handler = handler; |
1616 | 1616 | ||
1617 | if (!(_retu->calls = calloc( sizeof (MSICall *), max_calls ))) { | 1617 | if (!(retu->calls = calloc( sizeof (MSICall *), max_calls ))) { |
1618 | LOGGER_ERROR("Allocation failed! Program might misbehave!"); | 1618 | LOGGER_ERROR("Allocation failed! Program might misbehave!"); |
1619 | free(_retu); | 1619 | free(retu); |
1620 | return NULL; | 1620 | return NULL; |
1621 | } | 1621 | } |
1622 | 1622 | ||
1623 | _retu->max_calls = max_calls; | 1623 | retu->max_calls = max_calls; |
1624 | 1624 | ||
1625 | _retu->frequ = 10000; /* default value? */ | 1625 | retu->frequ = 10000; /* default value? */ |
1626 | _retu->call_timeout = 30000; /* default value? */ | 1626 | retu->call_timeout = 30000; /* default value? */ |
1627 | 1627 | ||
1628 | 1628 | ||
1629 | m_callback_msi_packet(messenger, msi_handle_packet, _retu ); | 1629 | m_callback_msi_packet(messenger, msi_handle_packet, retu ); |
1630 | 1630 | ||
1631 | /* This is called when remote terminates session */ | 1631 | /* This is called when remote terminates session */ |
1632 | m_callback_connectionstatus_internal_av(messenger, handle_remote_connection_change, _retu); | 1632 | m_callback_connectionstatus_internal_av(messenger, handle_remote_connection_change, retu); |
1633 | 1633 | ||
1634 | pthread_mutex_init(&_retu->mutex, NULL); | 1634 | pthread_mutex_init(&retu->mutex, NULL); |
1635 | 1635 | ||
1636 | LOGGER_DEBUG("New msi session: %p max calls: %u", _retu, max_calls); | 1636 | LOGGER_DEBUG("New msi session: %p max calls: %u", retu, max_calls); |
1637 | return _retu; | 1637 | return retu; |
1638 | } | 1638 | } |
1639 | 1639 | ||
1640 | 1640 | ||