Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
Diff: call_manager.cpp
- Revision:
- 125:8ff4dc96ad58
- Parent:
- 124:c1b6c893e1c3
- Child:
- 126:1f90756250fb
diff -r c1b6c893e1c3 -r 8ff4dc96ad58 call_manager.cpp --- a/call_manager.cpp Wed May 13 14:25:57 2015 +0000 +++ b/call_manager.cpp Wed May 13 21:18:12 2015 +0000 @@ -56,19 +56,18 @@ } /* remove calls por timeout */ -void call_manager( Vector * v_call, Vector * v_cb, Timeslice * ts ) +void call_manager ( Vector * v_call, Vector * v_cb, Timeslice * ts ) { //FixME pode dar problema por conta do static static uint8_t data[ CB_BUFFER_SIZE ], write_buffer[ CB_BUFFER_SIZE ]; bool should_remove = false; - for( register uint8_t i = 0; i < v_call->size(); i++ ) + for ( register uint8_t i = 0; i < v_call->size(); i++ ) { should_remove = false; VZ_call * call = ( VZ_call * )v_call->get_element( i ); - /* if ( call == NULL ) continue; if ( end_call ) @@ -80,14 +79,12 @@ should_remove = true; } } - */ - if( call->is_timetofinish() || call->cbx_pkg_is_idle() || should_remove ) + if ( call->is_timetofinish() || call->cbx_pkg_is_idle() || should_remove ) { - //if( debug_invite && !should_remove ) - if( debug_invite && !should_remove ) + if ( debug_invite && !should_remove ) { - if( call->cbx_pkg_is_idle() ){ + if ( call->cbx_pkg_is_idle() ){ if( debug_invite ) debug_msg("[%d] Call timeout: no pkg", call->get_cb_ext () ); } else { if( debug_invite ) debug_msg("[%d] Call timeout", call->get_cb_ext () ); @@ -96,7 +93,7 @@ v_call->remove_element( i ); Call_Box * cb = find_CB ( v_cb, call->get_cb_ext() ); - if( cb != NULL ){ + if ( cb != NULL ){ data[ TIMESLICE_PLACE ] = 0; send2callboxes( build_cb_package( cb->get_ext(), cb->get_port(), CB_BYE, @@ -107,6 +104,12 @@ delete( call ); } } + if ( end_call_ext != 0 ) + { + if ( debug_invite ) debug_msg ( "Call from %i not foud", end_call_ext ); + end_call = false; + end_call_ext = 0; + } } void invite_handler( Vector * v_call, Vector * v_cb, Timeslice * ts, Call_Box * inviting_cb ){