![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
voltando a versao de n aberturas e fechamentos de sockets data 19/09
Dependencies: EthernetInterface NTPClient mbed-rtos mbed EALib
Fork of header_main_publish by
Diff: utils.cpp
- Revision:
- 4:de46f0d9b14d
- Parent:
- 3:cd9148672e25
- Child:
- 6:a10de9926fbe
--- a/utils.cpp Wed Sep 10 18:21:48 2014 +0000 +++ b/utils.cpp Thu Sep 11 14:23:47 2014 +0000 @@ -67,28 +67,46 @@ } void registry_aging( Vector * v_cb, uint8_t * data, uint8_t * write_buffer ){ + /* Call_Box * cb = NULL; - if( v_cb && data && write_buffer ){ - for( register int i = 0; i < v_cb->size(); i+=2 ){ + if( v_cb && data && write_buffer ){ + bool remove_slave = false; + int slave = 0x00; + 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->get_ext() % 2 ) continue; if( cb->is_timeout() ){ if( cb->reconfigure_timeout() == 0x00 ){ - debug_msg("Rec == 0x00 "); + debug_msg("( ext %d removed", cb->get_ext() ); + cb->unregistry(); + slave = cb->get_ext() + 1; + remove_slave = true; v_cb->remove_element( i ); - cb->unregistry(); delete( cb ); + break; }else{ cb->set_msg_id( ( ( cb->get_msg_id() ) + 1 ) & ( BIT7 ^ 0xff ) ); __send_to_cb__( __build_cb_package__( cb->get_ext(), cb->get_port(), __REGISTRY__, ( char * )data, cb->get_msg_id(), __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); cb->registry(); - cb = (Call_Box * )v_cb->get_element( i + 1 ); - cb->registry(); - debug_msg("morri no else"); } } } + if( remove_slave ){ + for( register int i = 0; i < v_cb->size(); i++ ){ + cb = (Call_Box * )v_cb->get_element( i ); + if( cb->get_ext() == slave ){ + debug_msg("( ext %d removed", cb->get_ext() ); + cb->unregistry(); + v_cb->remove_element( i ); + delete( cb ); + } + } + } + if( tam != v_cb->size() ) debug_msg("%d ---> %d", tam, v_cb->size() ); } + */ } int sip_manager( Vector * v_cb, Vector * v_call, uint8_t * write_buffer ){