Ignore:
Timestamp:
Jun 19, 2013, 11:05:49 AM (11 years ago)
Author:
hock@…
Message:

Reintegrate branch: 20130111-hock-message_classes

improvements:

  • new message classes (reboost, zero-copy)
  • "fast path" for direct links (skip overlay layer)
  • link-properties accessible from the application
  • SystemQueue can call boost::bind functions
  • protlib compatibility removed (32bit overhead saved in every message)
  • addressing2
  • AddressDiscovery discoveres only addresses on which we're actually listening
  • ariba serialization usage reduced (sill used in OverlayMsg)
  • Node::connect, easier and cleaner interface to start-up ariba from the application
  • ariba configs via JSON, XML, etc (boost::property_tree)
  • keep-alive overhead greatly reduced
  • (relayed) overlay links can actually be closed now
  • lost messages are detected in most cases
  • notification to the application when link is transformed into direct-link
  • overlay routing: send message to second best hop if it would be dropped otherwise
  • SequenceNumbers (only mechanisms, so for: upward compatibility)
  • various small fixes


regressions:

  • bluetooth is not yet working again
  • bootstrap modules deactivated
  • liblog4xx is not working (use cout-logging)

This patch brings great performance and stability improvements at cost of backward compatibility.
Also bluetooth and the bootstrap modules have not been ported to the new interfaces, yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/overlay/LinkDescriptor.h

    r6961 r12060  
    1212#include "ariba/communication/EndpointDescriptor.h"
    1313#include "ariba/CommunicationListener.h"
     14
     15// reboost messages
     16#include "ariba/utility/transport/messages/message.hpp"
     17#include <ariba/utility/misc/sha1.h>
     18
     19#include "ariba/overlay/SequenceNumber.h"
     20
    1421
    1522namespace ariba {
     
    3744class LinkDescriptor {
    3845public:
     46    struct message_queue_entry
     47    {
     48        reboost::message_t message;
     49        uint8_t priority;
     50    };
     51   
    3952        // ctor
    4053        LinkDescriptor() {
     54            time_t now = time(NULL);
     55           
    4156                // default values
    4257                this->up = false;
     58//         this->closing = false;
     59        this->failed = false;
    4360                this->fromRemote = false;
    4461                this->remoteNode = NodeID::UNSPECIFIED;
     
    4663                this->communicationUp = false;
    4764                this->communicationId = LinkID::UNSPECIFIED;
    48                 this->keepAliveTime = time(NULL);
    49                 this->keepAliveMissed = 0;
     65                this->keepAliveReceived = now;
     66                this->keepAliveSent = now;
    5067                this->relaying     = false;
    51                 this->timeRelaying = time(NULL);
     68                this->timeRelaying = now;
    5269                this->dropAfterRelaying = false;
    5370                this->service  = ServiceID::UNSPECIFIED;
     
    5673                this->remoteLink = LinkID::UNSPECIFIED;
    5774                this->autolink = false;
    58                 this->lastuse = time(NULL);
     75                this->lastuse = now;
    5976                this->retryCounter = 0;
     77                this->hops = -1;
     78       
     79        this->transmit_seqnums = false; // XXX
    6080        }
    6181
     
    6787        // general information about the link --------------------------------------
    6888        bool up;           ///< flag whether this link is up and running
     89//      bool closing;      ///< flag, whether this link is in the regular process of closing
     90        bool failed;       ///< flag, whether communication is (assumed to be) not/no longer possible on this link
    6991        bool fromRemote;   ///< flag, whether this link was requested from remote
    7092        NodeID remoteNode; ///< remote end-point node
    71         bool isVital() {
    72                 return up && keepAliveMissed == 0;
    73         }
    74         bool isDirectVital() {
    75                 return isVital() && communicationUp && !relayed;
    76         }
    7793
    7894
     
    8298        bool   communicationUp;   ///< flag, whether the communication is up
    8399
     100        // sequence numbers --------------------------------------------------------
     101        SequenceNumber last_sent_seqnum;
     102    bool transmit_seqnums;
     103   
    84104        // direct link retries -----------------------------------------------------
    85105        EndpointDescriptor endpoint;
     
    87107
    88108        // link alive information --------------------------------------------------
    89         time_t keepAliveTime; ///< the last time a keep-alive message was received
    90         int keepAliveMissed;  ///< the number of missed keep-alive messages
     109        time_t keepAliveReceived; ///< the last time a keep-alive message was received
     110        time_t keepAliveSent;  ///< the number of missed keep-alive messages
    91111        void setAlive() {
    92                 keepAliveMissed = 0;
    93                 keepAliveTime = time(NULL);
     112//              keepAliveSent = time(NULL);
     113                keepAliveReceived = time(NULL);
    94114        }
    95115
     
    98118        LinkID remoteLink; ///< the remote link id
    99119        vector<NodeID> routeRecord;
     120        int hops;
    100121
    101122        // relay state -------------------------------------------------------------
     
    114135        // auto links --------------------------------------------------------------
    115136        bool autolink;  ///< flag, whether this link is a auto-link
    116         time_t lastuse; ///< time, when the link was last used
    117         deque<Message*> messageQueue; ///< waiting messages to be delivered
     137        time_t lastuse; ///< time, when the link was last used XXX AUTO_LINK-ONLY
     138        deque<message_queue_entry> messageQueue; ///< waiting messages to be delivered
    118139        void setAutoUsed() {
    119140                if (autolink) lastuse = time(NULL);
     
    121142        /// drops waiting auto-link messages
    122143        void flushQueue() {
    123                 BOOST_FOREACH( Message* msg, messageQueue )     delete msg;
     144//              BOOST_FOREACH( Message* msg, messageQueue )     delete msg;  // XXX MARIO: shouldn't be necessary anymore, since we're using shared pointers
    124145                messageQueue.clear();
    125146        }
     
    127148        // string representation ---------------------------------------------------
    128149        std::string to_string() const {
     150            time_t now = time(NULL);
     151           
    129152                std::ostringstream s;
     153        if ( relayed )
     154            s << "[RELAYED-";
     155        else
     156            s << "[DIRECT-";
     157        s << "LINK] ";
     158        s << "id=" << overlayId.toString().substr(0,4) << " ";
     159        s << "serv=" << service.toString() << " ";
    130160                s << "up=" << up << " ";
    131161                s << "init=" << !fromRemote << " ";
    132                 s << "id=" << overlayId.toString().substr(0,4) << " ";
    133                 s << "serv=" << service.toString() << " ";
    134162                s << "node=" << remoteNode.toString().substr(0,4) << " ";
    135163                s << "relaying=" << relaying << " ";
    136                 s << "miss=" << keepAliveMissed << " ";
     164                s << "last_received=" << now - keepAliveReceived << "s ";
    137165                s << "auto=" << autolink << " ";
     166                s << "hops=" << hops << " ";
    138167                if ( relayed ) {
    139168                        s << "| Relayed: ";
     
    146175                } else {
    147176                        s << "| Direct: ";
    148                         s << "using id=" << communicationId.toString().substr(0,4) << " ";
     177                        s << "using [COMMUNICATION-LINK] id=" << communicationId.toString().substr(0,4) << " ";
    149178                        s << "(up=" << communicationUp << ") ";
    150179                }
Note: See TracChangeset for help on using the changeset viewer.