![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
voltando a versao de n aberturas e fechamentos de sockets
Dependencies: EthernetInterface NTPClient mbed-rtos_old mbed
Fork of header_main_public by
Diff: utils.cpp
- Revision:
- 13:ae278302dffe
- Parent:
- 12:07fd716e0f35
- Child:
- 14:22a35f575502
diff -r 07fd716e0f35 -r ae278302dffe utils.cpp --- a/utils.cpp Tue Sep 16 13:21:01 2014 +0000 +++ b/utils.cpp Tue Sep 16 15:09:11 2014 +0000 @@ -67,10 +67,8 @@ } void registry_aging( Vector * v_cb, uint8_t * data, uint8_t * write_buffer ){ - //debug_msg(""); Call_Box * cb = NULL; if( v_cb && data && write_buffer ){ - int tam = v_cb->size(); for( register int i = 0; i < v_cb->size(); i++ ){ cb = (Call_Box * )v_cb->get_element( i ); if( cb->is_timeout() ){ @@ -88,10 +86,7 @@ } } } - if( tam != v_cb->size() ) debug_msg("%d ---> %d", tam, v_cb->size() ); } - - /* Call_Box * cb = NULL; if( v_cb && data && write_buffer ){ @@ -135,26 +130,21 @@ } int sip_manager( Vector * v_cb, Vector * v_call, uint8_t * write_buffer ){ - debug_msg(""); static int index = 0; - debug_msg("v_cb->size() :: %d", v_cb->size() ); if( v_cb && write_buffer ){ if( v_cb->size() > 0 ){ if( index >= v_cb->size() ) index = 0; }else return 0; Call_Box * cb = (Call_Box * )v_cb->get_element( index ); - debug_msg("cb -- %p", cb ); - debug_msg("Cb Ext :: %d", cb->get_ext() ); /* Retorna = 0 :: ok < 0 :: tive problemas > 0 :: devo remover essa call do vetor de calls */ int returned_value = 0; - debug_msg("Cb Ext :: %d", cb->get_ext() ); + if( cb->status == cb_on_call || cb->status == cb_idle ) returned_value = cb->listen_SIP_server(); - //if( cb->status == cb_on_call ) returned_value = cb->listen_SIP_server(); - debug_msg(""); + index++; return( returned_value ); } @@ -164,7 +154,6 @@ /* remove calls por timeout */ void call_manager( Vector * v_call, Vector * v_cb, uint8_t * data, uint8_t * write_buffer, Timeslice * ts ){ - //debug_msg(""); for( register int i = 0; i < v_call->size(); i++ ){ VZ_call * call = ( VZ_call * )v_call->get_element( i ); if( call->is_timeout() || call->is_timetofinish() ){ @@ -179,7 +168,7 @@ __send_to_cb__( __build_cb_package__( cb->get_ext(), cb->get_port(), __CB_BYE__, ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); cb->send_bye(); - if( cb->sip ) set_status( cb->sip->status, sip_idle ); + set_status( cb->sip->status, sip_idle ); } delete( call ); }