91 if( internal_vector.size() == 0 ) {
94 for( ;it < internal_vector.end(); ++it ) {
95 if( addr == (*it).addr ) {
99 if( addr < (*it).addr ) {
114 it =
find( addr, &found );
120 if( !init( &addr_state.
state, handler_arg, addr )) {
124 internal_vector.insert( it, addr_state );
138 it =
find( addr, &found );
143 if( !rm( it->state, handler_arg ) ) {
144 fprintf( stderr,
"Call to cleanup peer state failed\n" );
147 internal_vector.erase( it );
156 return internal_vector.begin();
163 return internal_vector.end();
173 this->handler_arg = init_arg;
193 void setReady(
bool ready ) { this->ready = ready; }
PeerVector::const_iterator const_iterator
Definition: PeerList.hpp:76
Definition: Lockable.hpp:44
void * state
Definition: PeerList.hpp:48
const_iterator end()
Gets the end of the sequence container.
Definition: PeerList.hpp:162
Definition: windows/daemon_cl/ipcdef.hpp:275
PeerVector::iterator PeerVectorIt
Definition: PeerList.hpp:77
bool(* peer_rm_handler)(void *, void *)
Definition: PeerList.hpp:58
Definition: PeerList.hpp:46
std::vector< PeerAddrWithState > PeerVector
Definition: PeerList.hpp:63
bool(* peer_init_handler)(void **, void *, PeerAddr addr)
Definition: PeerList.hpp:54
void setInit(peer_init_handler init, void *init_arg)
Sets init handler.
Definition: PeerList.hpp:171
bool IsReady()
Gets ready flag.
Definition: PeerList.hpp:187
PeerVectorIt find(PeerAddr addr, bool *found)
Look for a peer address.
Definition: PeerList.hpp:88
PeerAddr addr
Definition: PeerList.hpp:47
Definition: PeerList.hpp:68
void setRm(peer_rm_handler rm)
Sets peer remove callback on the PeerList object.
Definition: PeerList.hpp:180
void setReady(bool ready)
Sets ready flag.
Definition: PeerList.hpp:193
const_iterator begin()
Gets the beginning of the sequence container.
Definition: PeerList.hpp:155
bool add(PeerAddr addr)
Add a new peer address.
Definition: PeerList.hpp:111
PeerList()
Definition: PeerList.hpp:81