![](/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:
- 3:cd9148672e25
- Parent:
- 2:93bec7313ccc
- Child:
- 4:de46f0d9b14d
diff -r 93bec7313ccc -r cd9148672e25 utils.cpp --- a/utils.cpp Wed Sep 10 14:32:19 2014 +0000 +++ b/utils.cpp Wed Sep 10 18:21:48 2014 +0000 @@ -68,22 +68,25 @@ void registry_aging( Vector * v_cb, uint8_t * data, uint8_t * write_buffer ){ Call_Box * cb = NULL; - for( register int i = 0; i < v_cb->size(); i++ ){ - cb = (Call_Box * )v_cb->get_element( i ); - if( cb->is_timeout() ){ - cb->reset_elapsed_time(); - cb->registry(); - /* - if( cb->reconfigure_timeout() == 0x00 ){ - v_cb->remove_element( i ); - cb->unregistry(); - delete( cb ); - }else{ - __send_to_cb__( __build_cb_package__( cb->get_ext(), cb->get_port(), __REGISTRY__, - ( char * )data, __REGISTRY__, __CB_BUFFER_SIZE__ - __VZ_HEADER_OFFSET__, write_buffer ) ); - cb->registry(); + if( v_cb && data && write_buffer ){ + for( register int i = 0; i < v_cb->size(); i+=2 ){ + cb = (Call_Box * )v_cb->get_element( i ); + if( cb->is_timeout() ){ + if( cb->reconfigure_timeout() == 0x00 ){ + debug_msg("Rec == 0x00 "); + v_cb->remove_element( i ); + cb->unregistry(); + delete( cb ); + }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"); + } } - */ } } }