2007-11-14 22:18:48 -05:00
/*
2007-12-11 20:29:14 -05:00
* libretroshare / src / pqi pqiperson . cc
2007-11-14 22:18:48 -05:00
*
* 3 P / PQI network interface for RetroShare .
*
* Copyright 2004 - 2006 by Robert Fernie .
*
* This library is free software ; you can redistribute it and / or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation .
*
* This library is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
* Library General Public License for more details .
*
* You should have received a copy of the GNU Library General Public
* License along with this library ; if not , write to the Free Software
* Foundation , Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307
* USA .
*
* Please report all bugs and problems to " retroshare@lunamutt.com " .
*
*/
# include "pqi/pqi.h"
# include "pqi/pqiperson.h"
2008-01-25 01:36:40 -05:00
# include "pqi/pqipersongrp.h"
2009-12-22 05:41:19 -05:00
# include "services/p3disc.h"
2007-11-14 22:18:48 -05:00
const int pqipersonzone = 82371 ;
2008-07-10 12:29:18 -04:00
# include "util/rsdebug.h"
2012-04-13 20:30:23 -04:00
# include "util/rsstring.h"
2007-11-14 22:18:48 -05:00
2008-07-09 05:55:09 -04:00
/****
* # define PERSON_DEBUG
* * * */
2007-11-14 22:18:48 -05:00
2008-01-25 01:36:40 -05:00
pqiperson : : pqiperson ( std : : string id , pqipersongrp * pg )
: PQInterface ( id ) , active ( false ) , activepqi ( NULL ) ,
inConnectAttempt ( false ) , waittimes ( 0 ) ,
pqipg ( pg )
2007-11-14 22:18:48 -05:00
{
2008-01-25 01:36:40 -05:00
/* must check id! */
2007-11-14 22:18:48 -05:00
return ;
}
pqiperson : : ~ pqiperson ( )
{
// clean up the children.
2008-01-25 01:36:40 -05:00
std : : map < uint32_t , pqiconnect * > : : iterator it ;
for ( it = kids . begin ( ) ; it ! = kids . end ( ) ; it + + )
2007-11-14 22:18:48 -05:00
{
2008-01-25 01:36:40 -05:00
pqiconnect * pc = ( it - > second ) ;
2007-11-14 22:18:48 -05:00
delete pc ;
}
2008-01-25 01:36:40 -05:00
kids . clear ( ) ;
2007-11-14 22:18:48 -05:00
}
// The PQInterface interface.
2011-09-04 16:01:30 -04:00
int pqiperson : : SendItem ( RsItem * i , uint32_t & serialized_size )
2007-11-14 22:18:48 -05:00
{
2012-04-13 20:30:23 -04:00
std : : string out = " pqiperson::SendItem() " ;
2007-11-14 22:18:48 -05:00
if ( active )
{
2012-04-13 20:30:23 -04:00
out + = " Active: Sending On \n " ;
i - > print_string ( out , 5 ) ;
2009-12-13 16:59:26 -05:00
# ifdef PERSON_DEBUG
2012-04-13 20:30:23 -04:00
std : : cerr < < out < < std : : endl ;
2009-12-13 16:59:26 -05:00
# endif
2011-09-04 16:01:30 -04:00
return activepqi - > SendItem ( i , serialized_size ) ;
2007-11-14 22:18:48 -05:00
}
else
{
2012-04-13 20:30:23 -04:00
out + = " Not Active: Used to put in ToGo Store \n " ;
out + = " Now deleting... " ;
2007-11-14 22:18:48 -05:00
delete i ;
}
2012-04-13 20:30:23 -04:00
pqioutput ( PQL_DEBUG_BASIC , pqipersonzone , out ) ;
2007-11-14 22:18:48 -05:00
return 0 ; // queued.
}
2007-12-11 20:29:14 -05:00
RsItem * pqiperson : : GetItem ( )
2007-11-14 22:18:48 -05:00
{
if ( active )
return activepqi - > GetItem ( ) ;
// else not possible.
return NULL ;
}
int pqiperson : : status ( )
{
if ( active )
return activepqi - > status ( ) ;
return - 1 ;
}
2009-12-22 05:41:19 -05:00
int pqiperson : : receiveHeartbeat ( )
{
2011-07-18 20:06:09 -04:00
pqioutput ( PQL_WARNING , pqipersonzone , " pqiperson::receiveHeartbeat() from peer : " + PeerId ( ) ) ;
2009-12-22 05:41:19 -05:00
lastHeartbeatReceived = time ( NULL ) ;
2010-01-27 03:24:39 -05:00
return true ;
2009-12-22 05:41:19 -05:00
}
2007-11-14 22:18:48 -05:00
// tick......
int pqiperson : : tick ( )
{
2009-12-22 05:41:19 -05:00
//if lastHeartbeatReceived is 0, it might be not activated so don't do a net reset.
2012-01-19 11:23:57 -05:00
if ( active & & ( lastHeartbeatReceived ! = 0 ) & &
2011-07-18 20:06:09 -04:00
( time ( NULL ) - lastHeartbeatReceived ) > HEARTBEAT_REPEAT_TIME * 5 )
{
2012-01-19 11:23:57 -05:00
int ageLastIncoming = time ( NULL ) - activepqi - > getLastIncomingTS ( ) ;
2012-04-13 20:30:23 -04:00
std : : string out = " pqiperson::tick() WARNING No heartbeat from: " + PeerId ( ) ;
2012-01-19 11:23:57 -05:00
//out << " assume dead. calling pqissl::reset(), LastHeartbeat was: ";
2012-04-13 20:30:23 -04:00
rs_sprintf_append ( out , " LastHeartbeat was: %ld secs ago " , time ( NULL ) - lastHeartbeatReceived ) ;
rs_sprintf_append ( out , " LastIncoming was: %d secs ago " , ageLastIncoming ) ;
pqioutput ( PQL_WARNING , pqipersonzone , out ) ;
2009-12-22 05:41:19 -05:00
2012-01-19 11:23:57 -05:00
# define NO_PACKET_TIMEOUT 60
if ( ageLastIncoming > NO_PACKET_TIMEOUT )
{
2012-04-13 20:30:23 -04:00
out = " pqiperson::tick() " + PeerId ( ) ;
out + = " No Heartbeat & No Packets -> assume dead. calling pqissl::reset() " ;
pqioutput ( PQL_WARNING , pqipersonzone , out ) ;
2012-01-19 11:23:57 -05:00
this - > reset ( ) ;
}
}
int activeTick = 0 ;
2007-11-14 22:18:48 -05:00
{
2012-04-13 20:30:23 -04:00
std : : string out = " pqiperson::tick() Id: " + PeerId ( ) + " " ;
if ( active )
out + = " ***Active*** " ;
else
out + = " >>InActive<< " ;
2007-11-14 22:18:48 -05:00
2012-04-13 20:30:23 -04:00
out + = " \n " ;
rs_sprintf_append ( out , " Activepqi: %p inConnectAttempt: " , activepqi ) ;
2007-11-14 22:18:48 -05:00
2012-04-13 20:30:23 -04:00
if ( inConnectAttempt )
out + = " In Connection Attempt " ;
else
out + = " Not Connecting " ;
out + = " \n " ;
2007-11-14 22:18:48 -05:00
2012-04-13 20:30:23 -04:00
// tick the children.
std : : map < uint32_t , pqiconnect * > : : iterator it ;
for ( it = kids . begin ( ) ; it ! = kids . end ( ) ; it + + )
2007-11-14 22:18:48 -05:00
{
2012-04-13 20:30:23 -04:00
if ( 0 < ( it - > second ) - > tick ( ) )
{
activeTick = 1 ;
}
rs_sprintf_append ( out , " \t Ticking Child: %d \n " , it - > first ) ;
2007-11-14 22:18:48 -05:00
}
2012-04-13 20:30:23 -04:00
pqioutput ( PQL_DEBUG_ALL , pqipersonzone , out ) ;
2007-11-14 22:18:48 -05:00
} // end of pqioutput.
return activeTick ;
}
// callback function for the child - notify of a change.
// This is only used for out-of-band info....
// otherwise could get dangerous loops.
int pqiperson : : notifyEvent ( NetInterface * ni , int newState )
{
{
2012-04-13 20:30:23 -04:00
std : : string out = " pqiperson::notifyEvent() Id: " + PeerId ( ) + " \n " ;
rs_sprintf_append ( out , " Message: %d from: %p \n " , newState , ni ) ;
rs_sprintf_append ( out , " Active pqi : %p " , activepqi ) ;
2007-11-14 22:18:48 -05:00
2012-04-13 20:30:23 -04:00
pqioutput ( PQL_DEBUG_BASIC , pqipersonzone , out ) ;
2007-11-14 22:18:48 -05:00
}
/* find the pqi, */
2010-06-25 18:00:38 -04:00
pqiconnect * pqi = NULL ;
2008-03-26 11:35:09 -04:00
uint32_t type = 0 ;
2008-01-25 01:36:40 -05:00
std : : map < uint32_t , pqiconnect * > : : iterator it ;
2007-11-14 22:18:48 -05:00
/* start again */
int i = 0 ;
for ( it = kids . begin ( ) ; it ! = kids . end ( ) ; it + + )
{
2012-04-13 20:30:23 -04:00
std : : string out ;
rs_sprintf ( out , " pqiperson::connectattempt() Kid# %d of %u \n " , i , kids . size ( ) ) ;
rs_sprintf_append ( out , " type: %u in_ni: %p " , it - > first , ni ) ;
pqioutput ( PQL_DEBUG_BASIC , pqipersonzone , out ) ;
2010-06-25 18:00:38 -04:00
i + + ;
2007-11-14 22:18:48 -05:00
2008-01-25 01:36:40 -05:00
if ( ( it - > second ) - > thisNetInterface ( ni ) )
2007-11-14 22:18:48 -05:00
{
2010-06-25 18:00:38 -04:00
pqi = ( it - > second ) ;
2008-03-26 11:35:09 -04:00
type = ( it - > first ) ;
2007-11-14 22:18:48 -05:00
}
}
if ( ! pqi )
{
pqioutput ( PQL_WARNING , pqipersonzone , " Unknown notfyEvent Source! " ) ;
return - 1 ;
}
2010-06-25 18:00:38 -04:00
2007-11-14 22:18:48 -05:00
switch ( newState )
{
case CONNECT_RECEIVED :
case CONNECT_SUCCESS :
2008-01-25 01:36:40 -05:00
/* notify */
2009-12-14 13:11:19 -05:00
if ( pqipg ) {
struct sockaddr_in remote_peer_address ;
pqi - > getConnectAddress ( remote_peer_address ) ;
pqipg - > notifyConnect ( PeerId ( ) , type , true , remote_peer_address ) ;
}
2008-01-25 01:36:40 -05:00
2007-11-14 22:18:48 -05:00
if ( ( active ) & & ( activepqi ! = pqi ) ) // already connected - trouble
{
2012-04-13 20:30:23 -04:00
pqioutput ( PQL_WARNING , pqipersonzone , " pqiperson::notifyEvent() Id: " + PeerId ( ) + " CONNECT_SUCCESS+active-> activing new connection, shutting others " ) ;
2007-11-14 22:18:48 -05:00
// This is the RESET that's killing the connections.....
2009-12-13 16:59:26 -05:00
//activepqi -> reset();
2007-11-14 22:18:48 -05:00
// this causes a recursive call back into this fn.
// which cleans up state.
// we only do this if its not going to mess with new conn.
}
/* now install a new one. */
{
2012-04-13 20:30:23 -04:00
pqioutput ( PQL_WARNING , pqipersonzone , " pqiperson::notifyEvent() Id: " + PeerId ( ) + " CONNECT_SUCCESS->marking so! (resetting others) " ) ;
2012-01-18 17:51:38 -05:00
2010-06-25 18:00:38 -04:00
// mark as active.
2007-11-14 22:18:48 -05:00
active = true ;
2009-12-22 05:41:19 -05:00
lastHeartbeatReceived = 0 ;
2007-11-14 22:18:48 -05:00
activepqi = pqi ;
2010-06-25 18:00:38 -04:00
inConnectAttempt = false ;
2008-03-26 11:35:09 -04:00
/* reset all other children? (clear up long UDP attempt) */
for ( it = kids . begin ( ) ; it ! = kids . end ( ) ; it + + )
{
2012-04-13 20:30:23 -04:00
if ( ! ( it - > second ) - > thisNetInterface ( ni ) )
{
std : : string out ;
rs_sprintf ( out , " Resetting pqi ref : %p " , & ( it - > second ) ) ;
pqioutput ( PQL_DEBUG_BASIC , pqipersonzone , out ) ;
it - > second - > reset ( ) ;
} else {
//std::cerr << "Active pqi : not resetting." << std::endl;
}
2008-03-26 11:35:09 -04:00
}
2007-11-14 22:18:48 -05:00
return 1 ;
}
break ;
case CONNECT_UNREACHABLE :
case CONNECT_FIREWALLED :
case CONNECT_FAILED :
2008-01-25 01:36:40 -05:00
2007-11-14 22:18:48 -05:00
if ( active )
{
2010-06-25 18:00:38 -04:00
if ( activepqi = = pqi )
2007-11-14 22:18:48 -05:00
{
2012-04-13 20:30:23 -04:00
pqioutput ( PQL_WARNING , pqipersonzone , " pqiperson::notifyEvent() Id: " + PeerId ( ) + " CONNECT_FAILED->marking so! " ) ;
2012-01-18 17:51:38 -05:00
2007-11-14 22:18:48 -05:00
active = false ;
activepqi = NULL ;
2012-04-13 20:30:23 -04:00
}
2012-01-18 17:51:38 -05:00
else
2011-07-11 08:11:58 -04:00
{
2012-04-13 20:30:23 -04:00
pqioutput ( PQL_WARNING , pqipersonzone , " pqiperson::notifyEvent() Id: " + PeerId ( ) + " CONNECT_FAILED-> from an unactive connection, don't flag the peer as not connected, just try next attempt ! " ) ;
}
}
2007-11-14 22:18:48 -05:00
else
{
2012-04-13 20:30:23 -04:00
pqioutput ( PQL_WARNING , pqipersonzone , " pqiperson::notifyEvent() Id: " + PeerId ( ) + " CONNECT_FAILED+NOT active -> try connect again " ) ;
2007-11-14 22:18:48 -05:00
}
2008-03-21 15:06:34 -04:00
2011-07-11 08:11:58 -04:00
/* notify up */
2010-06-25 18:00:38 -04:00
if ( pqipg )
{
2012-04-13 20:30:23 -04:00
struct sockaddr_in raddr ;
2010-06-25 18:00:38 -04:00
sockaddr_clear ( & raddr ) ;
pqipg - > notifyConnect ( PeerId ( ) , type , false , raddr ) ;
}
2008-03-21 15:06:34 -04:00
return 1 ;
2007-11-14 22:18:48 -05:00
break ;
default :
break ;
}
return - 1 ;
}
/***************** Not PQInterface Fns ***********************/
int pqiperson : : reset ( )
{
2012-04-13 20:30:23 -04:00
pqioutput ( PQL_WARNING , pqipersonzone , " pqiperson::reset() resetting all pqiconnect for Id: " + PeerId ( ) ) ;
2007-11-14 22:18:48 -05:00
2008-01-25 01:36:40 -05:00
std : : map < uint32_t , pqiconnect * > : : iterator it ;
2007-11-14 22:18:48 -05:00
for ( it = kids . begin ( ) ; it ! = kids . end ( ) ; it + + )
{
2008-01-25 01:36:40 -05:00
( it - > second ) - > reset ( ) ;
2007-11-14 22:18:48 -05:00
}
activepqi = NULL ;
active = false ;
2012-04-13 20:30:23 -04:00
lastHeartbeatReceived = 0 ;
2007-11-14 22:18:48 -05:00
return 1 ;
}
2008-01-25 01:36:40 -05:00
int pqiperson : : addChildInterface ( uint32_t type , pqiconnect * pqi )
2007-11-14 22:18:48 -05:00
{
{
2012-04-13 20:30:23 -04:00
std : : string out ;
rs_sprintf ( out , " pqiperson::addChildInterface() : Id %s %u " , PeerId ( ) . c_str ( ) , type ) ;
pqioutput ( PQL_DEBUG_BASIC , pqipersonzone , out ) ;
2007-11-14 22:18:48 -05:00
}
2008-01-25 01:36:40 -05:00
kids [ type ] = pqi ;
2007-11-14 22:18:48 -05:00
return 1 ;
}
/***************** PRIVATE FUNCTIONS ***********************/
// functions to iterate over the connects and change state.
int pqiperson : : listen ( )
{
2012-04-13 20:30:23 -04:00
pqioutput ( PQL_DEBUG_BASIC , pqipersonzone , " pqiperson::listen() Id: " + PeerId ( ) ) ;
2007-11-14 22:18:48 -05:00
if ( ! active )
{
2008-01-25 01:36:40 -05:00
std : : map < uint32_t , pqiconnect * > : : iterator it ;
2007-11-14 22:18:48 -05:00
for ( it = kids . begin ( ) ; it ! = kids . end ( ) ; it + + )
{
// set them all listening.
2008-01-25 01:36:40 -05:00
( it - > second ) - > listen ( ) ;
2007-11-14 22:18:48 -05:00
}
}
return 1 ;
}
int pqiperson : : stoplistening ( )
{
2012-04-13 20:30:23 -04:00
pqioutput ( PQL_DEBUG_BASIC , pqipersonzone , " pqiperson::stoplistening() Id: " + PeerId ( ) ) ;
2007-11-14 22:18:48 -05:00
2008-01-25 01:36:40 -05:00
std : : map < uint32_t , pqiconnect * > : : iterator it ;
2007-11-14 22:18:48 -05:00
for ( it = kids . begin ( ) ; it ! = kids . end ( ) ; it + + )
{
// set them all listening.
2008-01-25 01:36:40 -05:00
( it - > second ) - > stoplistening ( ) ;
2007-11-14 22:18:48 -05:00
}
return 1 ;
}
2011-07-14 10:56:33 -04:00
int pqiperson : : connect ( uint32_t type , struct sockaddr_in raddr ,
struct sockaddr_in & proxyaddr , struct sockaddr_in & srcaddr ,
uint32_t delay , uint32_t period , uint32_t timeout , uint32_t flags , uint32_t bandwidth )
2007-11-14 22:18:48 -05:00
{
2008-07-09 05:55:09 -04:00
# ifdef PERSON_DEBUG
2011-08-06 08:27:23 -04:00
# endif
2007-11-14 22:18:48 -05:00
{
2012-04-13 20:30:23 -04:00
std : : string out = " pqiperson::connect() Id: " + PeerId ( ) ;
rs_sprintf_append ( out , " type: %u " , type ) ;
rs_sprintf_append ( out , " addr: %s:%u " , rs_inet_ntoa ( raddr . sin_addr ) . c_str ( ) , ntohs ( raddr . sin_port ) ) ;
rs_sprintf_append ( out , " proxyaddr: %s:%u " , rs_inet_ntoa ( proxyaddr . sin_addr ) . c_str ( ) , ntohs ( proxyaddr . sin_port ) ) ;
rs_sprintf_append ( out , " srcaddr: %s:%u " , rs_inet_ntoa ( srcaddr . sin_addr ) . c_str ( ) , ntohs ( srcaddr . sin_port ) ) ;
rs_sprintf_append ( out , " delay: %u " , delay ) ;
rs_sprintf_append ( out , " period: %u " , period ) ;
rs_sprintf_append ( out , " timeout: %u " , timeout ) ;
rs_sprintf_append ( out , " flags: %u " , flags ) ;
rs_sprintf_append ( out , " bandwidth: %u " , bandwidth ) ;
//std::cerr << out.str();
pqioutput ( PQL_WARNING , pqipersonzone , out ) ;
2007-11-14 22:18:48 -05:00
}
2008-01-25 01:36:40 -05:00
std : : map < uint32_t , pqiconnect * > : : iterator it ;
it = kids . find ( type ) ;
2007-11-14 22:18:48 -05:00
if ( it = = kids . end ( ) )
{
2008-07-09 05:55:09 -04:00
# ifdef PERSON_DEBUG
2012-04-13 20:30:23 -04:00
//pqioutput(PQL_DEBUG_BASIC, pqipersonzone, "pqiperson::connect() missing pqiconnect");
2008-07-09 05:55:09 -04:00
# endif
2010-07-04 06:35:38 -04:00
/* notify of fail! */
pqipg - > notifyConnect ( PeerId ( ) , type , false , raddr ) ;
2008-02-26 21:32:20 -05:00
return 0 ;
2007-11-14 22:18:48 -05:00
}
2008-02-26 21:32:20 -05:00
2011-07-13 18:23:40 -04:00
# ifdef PERSON_DEBUG
2012-01-20 10:13:50 -05:00
std : : cerr < < " pqiperson::connect() WARNING, resetting for new connection attempt " < < std : : endl ;
2011-07-13 18:23:40 -04:00
# endif
2008-02-26 21:32:20 -05:00
/* set the parameters */
2011-08-06 08:27:23 -04:00
pqioutput ( PQL_WARNING , pqipersonzone , " pqiperson::connect reset() before connection attempt " ) ;
2008-03-21 15:06:34 -04:00
( it - > second ) - > reset ( ) ;
2008-03-26 11:35:09 -04:00
2012-01-20 10:13:50 -05:00
# ifdef PERSON_DEBUG
2012-01-08 13:40:09 -05:00
std : : cerr < < " pqiperson::connect() WARNING, clearing rate cap " < < std : : endl ;
2012-01-20 10:13:50 -05:00
# endif
2012-01-08 13:40:09 -05:00
setRateCap ( 0 , 0 ) ;
2008-07-09 05:55:09 -04:00
# ifdef PERSON_DEBUG
2008-03-26 11:35:09 -04:00
std : : cerr < < " pqiperson::connect() setting connect_parameters " < < std : : endl ;
2008-07-09 05:55:09 -04:00
# endif
2008-02-26 21:32:20 -05:00
( it - > second ) - > connect_parameter ( NET_PARAM_CONNECT_DELAY , delay ) ;
( it - > second ) - > connect_parameter ( NET_PARAM_CONNECT_PERIOD , period ) ;
2008-03-26 11:35:09 -04:00
( it - > second ) - > connect_parameter ( NET_PARAM_CONNECT_TIMEOUT , timeout ) ;
2011-07-13 18:23:40 -04:00
( it - > second ) - > connect_parameter ( NET_PARAM_CONNECT_FLAGS , flags ) ;
2011-07-14 10:56:33 -04:00
( it - > second ) - > connect_parameter ( NET_PARAM_CONNECT_BANDWIDTH , bandwidth ) ;
2008-03-26 11:35:09 -04:00
2011-07-14 10:56:33 -04:00
( it - > second ) - > connect_additional_address ( NET_PARAM_CONNECT_PROXY , & proxyaddr ) ;
( it - > second ) - > connect_additional_address ( NET_PARAM_CONNECT_SOURCE , & srcaddr ) ;
( it - > second ) - > connect ( raddr ) ;
2007-11-14 22:18:48 -05:00
// flag if we started a new connectionAttempt.
2008-01-25 01:36:40 -05:00
inConnectAttempt = true ;
2007-11-14 22:18:48 -05:00
return 1 ;
}
2009-12-13 16:59:26 -05:00
pqiconnect * pqiperson : : getKid ( uint32_t type )
{
std : : map < uint32_t , pqiconnect * > : : iterator it ;
2010-02-25 17:44:04 -05:00
if ( kids . empty ( ) ) {
return NULL ;
}
2009-12-13 16:59:26 -05:00
it = kids . find ( type ) ;
if ( it = = kids . end ( ) )
{
return NULL ;
} else {
return it - > second ;
}
}
2012-06-21 21:35:32 -04:00
void pqiperson : : getRates ( RsBwRates & rates )
{
// get the rate from the active one.
if ( ( ! active ) | | ( activepqi = = NULL ) )
return ;
activepqi - > getRates ( rates ) ;
}
int pqiperson : : getQueueSize ( bool in )
{
// get the rate from the active one.
if ( ( ! active ) | | ( activepqi = = NULL ) )
return 0 ;
return activepqi - > getQueueSize ( in ) ;
}
2007-11-14 22:18:48 -05:00
float pqiperson : : getRate ( bool in )
{
// get the rate from the active one.
if ( ( ! active ) | | ( activepqi = = NULL ) )
return 0 ;
return activepqi - > getRate ( in ) ;
}
void pqiperson : : setMaxRate ( bool in , float val )
{
// set to all of them. (and us)
PQInterface : : setMaxRate ( in , val ) ;
// clean up the children.
2008-01-25 01:36:40 -05:00
std : : map < uint32_t , pqiconnect * > : : iterator it ;
2007-11-14 22:18:48 -05:00
for ( it = kids . begin ( ) ; it ! = kids . end ( ) ; it + + )
{
2008-01-25 01:36:40 -05:00
( it - > second ) - > setMaxRate ( in , val ) ;
2007-11-14 22:18:48 -05:00
}
}
2012-01-08 13:40:09 -05:00
void pqiperson : : setRateCap ( float val_in , float val_out )
{
// set to all of them. (and us)
PQInterface : : setRateCap ( val_in , val_out ) ;
// clean up the children.
std : : map < uint32_t , pqiconnect * > : : iterator it ;
for ( it = kids . begin ( ) ; it ! = kids . end ( ) ; it + + )
{
( it - > second ) - > setRateCap ( val_in , val_out ) ;
}
}