Added new callback

This commit is contained in:
mannol 2014-03-14 23:10:10 +01:00
parent 3acf43b76a
commit e990f05817
4 changed files with 23 additions and 20 deletions

View File

@ -117,7 +117,7 @@ typedef struct _MSIMessage {
static struct _Callbacks {
MSICallback function;
void* data;
} callbacks[10] = {0};
} callbacks[11] = {0};
inline__ void invoke_callback(MSICallbackID id)
{
@ -653,7 +653,8 @@ void handle_remote_connection_change(Messenger *messenger, int friend_num, uint8
for ( ; i < session->call->peer_count; i ++ )
if ( session->call->peers[i] == friend_num ) {
msi_stopcall(session); /* Stop the call for now */
invoke_callback(MSI_OnPeerTimeout);
/*msi_stopcall(session); /* Stop the call for now */
return;
}
}
@ -747,10 +748,9 @@ void *handle_timeout ( void *arg )
}
return NULL;
pthread_exit(NULL);
}
/**
* @brief Add peer to peer list.
*
@ -1245,12 +1245,11 @@ int msi_terminate_session ( MSISession *session )
int _status = 0;
terminate_call ( session );
/* If have call, cancel it */
if ( session->call ) msi_cancel(session, 0, "MSI session terminated!");
m_callback_msi_packet((struct Messenger *) session->messenger_handle, NULL, NULL);
/* TODO: Clean it up more? */
free ( session );
return _status;
}

View File

@ -131,7 +131,8 @@ typedef enum {
/* Protocol */
MSI_OnError,
MSI_OnRequestTimeout
MSI_OnRequestTimeout,
MSI_OnPeerTimeout
} MSICallbackID;

View File

@ -1147,18 +1147,21 @@ failed_init_ffmpeg: ;
int av_terminate_session(av_session_t *_phone)
{
toxav_hangup(_phone->av);
_phone->running_decaud = 0;
usleep(100000); /* Wait for tox_poll to end */
toxav_kill(_phone->av);
printf("\r[i] KILLED AV ARGH!\n");
usleep(1000000); /* Wait for cancel request to be sent */
Tox *_p = _phone->_messenger;
_phone->_messenger = NULL;
tox_kill(_p);
free(_phone->_friends);
pthread_mutex_destroy ( &_phone->_mutex );
Tox *_p = _phone->_messenger;
_phone->_messenger = NULL;
usleep(100000); /* Wait for tox_poll to end */
tox_kill(_p);
toxav_kill(_phone->av);
free(_phone);
printf("\r[i] Quit!\n");

View File

@ -70,8 +70,8 @@ typedef enum {
/* Protocol */
av_OnError,
av_OnRequestTimeout
av_OnRequestTimeout,
av_OnPeerTimeout
} ToxAvCallbackID;