diff options
-rwxr-xr-x | toxav/msi.c | 16 | ||||
-rwxr-xr-x | toxav/msi.h | 3 | ||||
-rwxr-xr-x | toxav/phone.c | 19 | ||||
-rwxr-xr-x | toxav/toxav.h | 4 |
4 files changed, 22 insertions, 20 deletions
diff --git a/toxav/msi.c b/toxav/msi.c index 4bae076f..928e24c4 100755 --- a/toxav/msi.c +++ b/toxav/msi.c | |||
@@ -117,7 +117,7 @@ typedef struct _MSIMessage { | |||
117 | static struct _Callbacks { | 117 | static struct _Callbacks { |
118 | MSICallback function; | 118 | MSICallback function; |
119 | void* data; | 119 | void* data; |
120 | } callbacks[10] = {0}; | 120 | } callbacks[11] = {0}; |
121 | 121 | ||
122 | inline__ void invoke_callback(MSICallbackID id) | 122 | inline__ void invoke_callback(MSICallbackID id) |
123 | { | 123 | { |
@@ -653,7 +653,7 @@ void handle_remote_connection_change(Messenger *messenger, int friend_num, uint8 | |||
653 | 653 | ||
654 | for ( ; i < session->call->peer_count; i ++ ) | 654 | for ( ; i < session->call->peer_count; i ++ ) |
655 | if ( session->call->peers[i] == friend_num ) { | 655 | if ( session->call->peers[i] == friend_num ) { |
656 | msi_stopcall(session); /* Stop the call for now */ | 656 | invoke_callback(MSI_OnPeerTimeout); |
657 | return; | 657 | return; |
658 | } | 658 | } |
659 | } | 659 | } |
@@ -747,10 +747,9 @@ void *handle_timeout ( void *arg ) | |||
747 | 747 | ||
748 | } | 748 | } |
749 | 749 | ||
750 | return NULL; | 750 | pthread_exit(NULL); |
751 | } | 751 | } |
752 | 752 | ||
753 | |||
754 | /** | 753 | /** |
755 | * @brief Add peer to peer list. | 754 | * @brief Add peer to peer list. |
756 | * | 755 | * |
@@ -1244,13 +1243,12 @@ int msi_terminate_session ( MSISession *session ) | |||
1244 | assert ( session ); | 1243 | assert ( session ); |
1245 | 1244 | ||
1246 | int _status = 0; | 1245 | int _status = 0; |
1247 | 1246 | ||
1248 | terminate_call ( session ); | 1247 | /* If have call, cancel it */ |
1248 | if ( session->call ) msi_cancel(session, 0, "MSI session terminated!"); | ||
1249 | |||
1249 | m_callback_msi_packet((struct Messenger *) session->messenger_handle, NULL, NULL); | 1250 | m_callback_msi_packet((struct Messenger *) session->messenger_handle, NULL, NULL); |
1250 | 1251 | ||
1251 | |||
1252 | /* TODO: Clean it up more? */ | ||
1253 | |||
1254 | free ( session ); | 1252 | free ( session ); |
1255 | return _status; | 1253 | return _status; |
1256 | } | 1254 | } |
diff --git a/toxav/msi.h b/toxav/msi.h index fcc24b4a..37fc07a3 100755 --- a/toxav/msi.h +++ b/toxav/msi.h | |||
@@ -131,7 +131,8 @@ typedef enum { | |||
131 | 131 | ||
132 | /* Protocol */ | 132 | /* Protocol */ |
133 | MSI_OnError, | 133 | MSI_OnError, |
134 | MSI_OnRequestTimeout | 134 | MSI_OnRequestTimeout, |
135 | MSI_OnPeerTimeout | ||
135 | 136 | ||
136 | } MSICallbackID; | 137 | } MSICallbackID; |
137 | 138 | ||
diff --git a/toxav/phone.c b/toxav/phone.c index 43d24a2f..fb159f57 100755 --- a/toxav/phone.c +++ b/toxav/phone.c | |||
@@ -1147,18 +1147,21 @@ failed_init_ffmpeg: ; | |||
1147 | 1147 | ||
1148 | int av_terminate_session(av_session_t *_phone) | 1148 | int av_terminate_session(av_session_t *_phone) |
1149 | { | 1149 | { |
1150 | toxav_hangup(_phone->av); | 1150 | _phone->running_decaud = 0; |
1151 | 1151 | usleep(100000); /* Wait for tox_poll to end */ | |
1152 | free(_phone->_friends); | 1152 | |
1153 | pthread_mutex_destroy ( &_phone->_mutex ); | 1153 | toxav_kill(_phone->av); |
1154 | 1154 | printf("\r[i] KILLED AV ARGH!\n"); | |
1155 | |||
1156 | usleep(1000000); /* Wait for cancel request to be sent */ | ||
1155 | Tox *_p = _phone->_messenger; | 1157 | Tox *_p = _phone->_messenger; |
1156 | _phone->_messenger = NULL; | 1158 | _phone->_messenger = NULL; |
1157 | usleep(100000); /* Wait for tox_poll to end */ | ||
1158 | |||
1159 | tox_kill(_p); | 1159 | tox_kill(_p); |
1160 | toxav_kill(_phone->av); | ||
1161 | 1160 | ||
1161 | |||
1162 | free(_phone->_friends); | ||
1163 | pthread_mutex_destroy ( &_phone->_mutex ); | ||
1164 | |||
1162 | free(_phone); | 1165 | free(_phone); |
1163 | 1166 | ||
1164 | printf("\r[i] Quit!\n"); | 1167 | printf("\r[i] Quit!\n"); |
diff --git a/toxav/toxav.h b/toxav/toxav.h index ffe79249..b67e82f8 100755 --- a/toxav/toxav.h +++ b/toxav/toxav.h | |||
@@ -70,8 +70,8 @@ typedef enum { | |||
70 | 70 | ||
71 | /* Protocol */ | 71 | /* Protocol */ |
72 | av_OnError, | 72 | av_OnError, |
73 | av_OnRequestTimeout | 73 | av_OnRequestTimeout, |
74 | 74 | av_OnPeerTimeout | |
75 | } ToxAvCallbackID; | 75 | } ToxAvCallbackID; |
76 | 76 | ||
77 | 77 | ||