Changeset 4738 for source


Ignore:
Timestamp:
Jul 4, 2009, 7:03:55 PM (15 years ago)
Author:
Christoph Mayer
Message:

relay infos

Location:
source/ariba
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/SideportListener.cpp

    r3374 r4738  
    7171}
    7272
     73//******************************************************
     74//
     75// JUST EXPERIMENTAL WITH RANDOM RESULTS
     76//
     77
     78// 0 = normal node    --> directly accessible
     79// 1 = relaying node  --> node that is relaying for us (must also be 0)
     80// 2 = relayed node   --> node that we cannot access directly
     81static map<NodeID,short> relayingnodes;
     82
     83bool SideportListener::isRelayingNode(const NodeID& node){
     84
     85        map<NodeID,short>::iterator i = relayingnodes.find(node);
     86        if(i != relayingnodes.end()) return (i->second == 1);
     87
     88        relayingnodes.insert( std::make_pair( node, rand()%3 ) );
     89}
     90
     91bool SideportListener::isRelayedNode(const NodeID& node){
     92
     93        map<NodeID,short>::iterator i = relayingnodes.find(node);
     94        if(i != relayingnodes.end()) return (i->second == 2);
     95
     96        relayingnodes.insert( std::make_pair( node, rand()%3 ) );
     97}
     98
     99//
     100//
     101//******************************************************
     102
    73103void SideportListener::configure( overlay::BaseOverlay* _overlay ) {
    74104        overlay = _overlay;
  • source/ariba/SideportListener.h

    r3374 r4738  
    4141
    4242#include <vector>
     43#include <map>
    4344#include "Identifiers.h"
    4445#include "CommunicationListener.h"
    4546
     47using std::map;
    4648using std::vector;
    4749
     
    131133                        ) const;
    132134
     135        /**
     136         * Is this node acting as a relay for us
     137         *
     138         * @param The node in question
     139         * @return true, if this node is relaying for us
     140         */
     141        bool isRelayingNode(const NodeID& node);
     142
     143        /**
     144         * Is this node only reachable for us through a relay?
     145         *
     146         * @param The node in question
     147         * @return true, if we reach this node only over a relay
     148         */
     149        bool isRelayedNode(const NodeID& node);
     150
    133151protected:
    134152
Note: See TracChangeset for help on using the changeset viewer.