Changeset 12438 for source


Ignore:
Timestamp:
Oct 2, 2013, 12:01:09 PM (11 years ago)
Author:
hock@…
Message:

new callbacks in ariba::NodeListener:

  • onOverlayConnected
  • onOverlayDisconnected
Location:
source/ariba
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/NodeListener.cpp

    r3037 r12438  
    6060}
    6161
     62void NodeListener::onOverlayConnected(const SpoVNetID& vid) {
     63}
     64
     65void NodeListener::onOverlayDisconnected(const SpoVNetID& vid){
     66}
     67
    6268} // namespace ariba
  • source/ariba/NodeListener.h

    r9684 r12438  
    5757 * @author Sebastian Mies <mies@tm.uka.de>
    5858 * @author Christoph Mayer <mayer@tm.uka.de>
     59 * @author Mario Hock <mario.hock@student.kit.edu>
    5960 */
    6061class NodeListener {
     
    9798         */
    9899        virtual void onLeaveFailed( const SpoVNetID& vid );
     100   
     101    /**
     102     * This event method is called, when the number of neighbours gets above one.
     103     *
     104     * Usually this means, the node is now connected to an existing spovnet, or
     105     * another node connected to this node and a "two-elemnt" spovnet just formed up.
     106     *
     107     * NOTE: This method can be called again, after »onOverlayDisconnected« has
     108     * been called.
     109     *
     110     * @param vid The spovnet id
     111     */
     112    virtual void onOverlayConnected( const SpoVNetID& vid );
     113   
     114    /**
     115     * This event method is called, when the number of neighbours drops to zero.
     116     *
     117     * Usually this means, the note has lost connection to the spovnet, or the
     118     * spovnet ceased to exist, since all other nodes are gone.
     119     *
     120     * NOTE: This method will only be called after »onOverlayConnected« has been
     121     * called.
     122     *
     123     * @param vid The spovnet id
     124     */
     125    virtual void onOverlayDisconnected( const SpoVNetID& vid );
    99126};
    100127
  • source/ariba/overlay/BaseOverlay.cpp

    r12060 r12438  
    795795
    796796BaseOverlay::BaseOverlay() :
    797                         started(false),state(BaseOverlayStateInvalid),
     797                        started(false),
     798                        connected(false),
     799                        state(BaseOverlayStateInvalid),
    798800                        bc(NULL),
    799801                        nodeId(NodeID::UNSPECIFIED), spovnetId(SpoVNetID::UNSPECIFIED),
     
    12451247        }
    12461248       
    1247         // TODO AKTUELL: sequence numbers
     1249        // TODO XXX ----> coordinate with QUIC-efforts !!
     1250        // TODO aktuell: sequence numbers
    12481251        // TODO seqnum on fast path ?
    12491252        ld->last_sent_seqnum.increment();
     
    16201623        // erase mapping
    16211624        eraseDescriptor(ld->overlayId);
     1625   
     1626   
     1627    // notify the application if this is the last link to a different node
     1628    if ( connected )
     1629    {
     1630        bool active_links = false;
     1631       
     1632        // look for links that are still active
     1633        foreach( LinkDescriptor* ld, links )
     1634        {
     1635            if ( isLinkDirectVital(ld) )
     1636            {
     1637                active_links = true;
     1638                break;
     1639            }
     1640        }
     1641
     1642        if ( ! active_links )
     1643        {
     1644            connected = false;
     1645           
     1646            foreach( NodeListener* i, nodeListeners )
     1647                i->onOverlayDisconnected( spovnetId );
     1648        }
     1649    }
     1650
    16221651}
    16231652
     
    20932122        sideport->onLinkUp( ld->overlayId, nodeId, ld->remoteNode, this->spovnetId );
    20942123
     2124   
     2125    // notify the application if this is the first link to a different node
     2126    if ( not connected )
     2127    {
     2128        connected = true;
     2129       
     2130        foreach( NodeListener* i, nodeListeners )
     2131            i->onOverlayConnected( spovnetId );
     2132    }
     2133   
    20952134        return true;
    20962135}
  • source/ariba/overlay/BaseOverlay.h

    r12060 r12438  
    425425        /// is the base overlay started yet
    426426        bool started;
     427   
     428    /// »true« if we have neighbours, »false« otherwise
     429    bool connected;
    427430
    428431        /// The state of the BaseOverlay
Note: See TracChangeset for help on using the changeset viewer.