Changeset 12773


Ignore:
Timestamp:
Mar 26, 2014, 6:28:32 PM (10 years ago)
Author:
hock@…
Message:

WARNING! This revision is not intended for productive use!

!! DEBUGGING ONLY !!

Extreme debugging of StreamTransport.
"Typo" in the locking-code, was very hard to track down!

This revision is stored since a lot dabug code was written and should not just be deleted.

Location:
source/ariba/utility/transport
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/utility/transport/StreamTransport/StreamTransport.cpp

    r12060 r12773  
    366366        parent(parent),
    367367        out_queues(8), //TODO How much priorities shall we have?
    368         sending(false)
     368        sending(false),
     369        MAGIC_NUMBER(424242)
    369370{
    370371        header.length = 0;
     
    594595    bool restart_sending = false;
    595596   
     597        // FIXME Mario DEBUGGING  --  copy !!
     598        reboost::shared_buffer_t buff = packet.linearize();
     599        reboost::message_t msg;
     600        msg.push_back(buff);
     601        assert ( msg.MAGIC_NUMBER == 421337 );
     602        // [ DEBUGGING ]
     603       
     604       
    596605    // enqueue packet  [locked]
    597606    {
    598         unique_lock(out_queues_lock);
    599        
    600         assert( priority < out_queues.size() );
    601         out_queues[priority].push(packet);
     607        boost::mutex::scoped_lock lock(out_queues_lock);
     608               
     609                int debuggingA = out_queues[priority].size();
     610//              assert ( debuggingA < 1000 ); // XXX
     611               
     612                assert ( this->valid );
     613       
     614        assert( priority < out_queues.size() );  // NOTE: actual assert, not in context with the extended debugging..
     615//         out_queues[priority].push(packet);  // FIXME Mario
     616                out_queues[priority].push(msg);            // FIXME Mario
     617               
     618                // XXX
     619                int debuggingB = out_queues[priority].size();
     620                int magic = out_queues[priority].back().MAGIC_NUMBER;
     621                assert ( debuggingB == debuggingA + 1 );
     622                assert ( magic == 421337 );
    602623       
    603624        if ( ! sending )
     
    622643    bool found = false;
    623644
     645        // XXX Mario: Debugging
     646        if ( ! this->valid )
     647        {
     648                this->sending = false;
     649                cout << "/// StreamConnection::send_next_package() on INVALID STREAM" << endl;
     650                return;
     651        }
     652       
    624653    // find packet with highest priority  [locked]
    625654    {
    626         unique_lock(out_queues_lock);
     655        boost::mutex::scoped_lock lock(out_queues_lock);
     656               
     657                assert ( this->valid ); // XXX TODO ggf. in if (valid) Àndern...
     658                assert ( this->sending );
     659                assert ( this->MAGIC_NUMBER == 424242 );
     660                assert ( this->out_queues.size() == 8 );
    627661       
    628662        for ( vector<OutQueue>::iterator it = out_queues.begin();
    629663                it != out_queues.end(); it++ )
    630664        {
     665                        int debugging = it->size();  // XXX debugging
     666//                      assert ( debugging < 1000 );
     667                       
    631668            if ( !it->empty() )
    632669            {
  • source/ariba/utility/transport/StreamTransport/StreamTransport.hpp

    r12060 r12773  
    6464        StreamConnection(boost::asio::io_service& io_service, StreamTransportPtr parent);
    6565       
    66         virtual ~StreamConnection() {}
     66        virtual ~StreamConnection()
     67                {
     68                        // XXX MARIO Debugging
     69                        std::cout << "/// ~StreamConnection(): " << this << ", SENDING: " << this->sending << ", VALID: " << this->valid << std::endl;
     70                       
     71                        assert ( this->valid == false );
     72                }
    6773       
    6874        /// Inherited from transport_connection
     
    127133        shared_buffer_t buffy;
    128134       
     135               
     136                // XXX Mario: Debugging
     137                const int MAGIC_NUMBER;
    129138    private:
    130139        std::vector<ariba::utility::LinkID*> communication_links;
  • source/ariba/utility/transport/messages/message.hpp

    r12060 r12773  
    1111#include<boost/shared_ptr.hpp>
    1212#include<cstring>
     13#include <cassert>
    1314
    1415#include "shared_buffer.hpp"
     
    6869        /// Create a new message
    6970        inline message_t() :
    70                 imsg() {
     71                imsg(),
     72                MAGIC_IDENTIFIER("!!message_t-MAGIC_IDENTIFIER!!"), // XXX Mario: Debugging
     73                MAGIC_NUMBER(421337) // XXX Mario: Debugging
     74        {
    7175        }
    7276
    7377        /// Copy message
    7478        inline message_t(const message_t& msg) :
    75                 imsg(msg.imsg)
     79                imsg(msg.imsg),
     80                MAGIC_IDENTIFIER(msg.MAGIC_IDENTIFIER),  // XXX
     81                MAGIC_NUMBER(msg.MAGIC_NUMBER) // XXX
     82
    7683        {
     84                assert ( msg.MAGIC_NUMBER == 421337 ); // XXX
     85               
    7786            if ( imsg )
    7887                imsg->owner = NULL;
     
    8594
    8695        /// Assign another message
    87         inline message_t& operator=(const message_t& msg) {
    88                 msg.imsg->owner = NULL;
    89                 imsg = msg.imsg;
     96        inline message_t& operator=(const message_t& msg)
     97        {
     98                assert ( msg.MAGIC_NUMBER == 421337 ); // XXX
     99               
     100                if ( msg.imsg )
     101                {
     102                        msg.imsg->owner = NULL;
     103                        imsg = msg.imsg;
     104                }
     105                else
     106                {
     107                        // TODO: is this a valid state? (since it can definitely been reached...)
     108                        imsg.reset();
     109                }
     110               
    90111                return *this;
    91112        }
     
    252273                shared_buffer_t buffers[message_max_buffers];
    253274                mlength_t index, length;
     275               
     276                // XXX Mario: Debugging
     277                const std::string MAGIC_IDENTIFIER;
     278                const int MAGIC_NUMBER;
    254279        public:
    255280                inline imsg_t() :
    256                         index(0), length(0) {
     281                        owner(NULL),
     282                        index(0),
     283                        length(0),
     284                        MAGIC_IDENTIFIER("!!imsg_t-MAGIC_IDENTIFIER!!"), // XXX Mario: Debugging
     285                        MAGIC_NUMBER(133742)
     286                {
    257287                }
    258288                inline imsg_t(const imsg_t& imsg) :
    259                         index(imsg.index), length(imsg.length) {
     289                        index(imsg.index), length(imsg.length),
     290                        MAGIC_IDENTIFIER(imsg.MAGIC_IDENTIFIER),  // XXX
     291                        MAGIC_NUMBER(imsg.MAGIC_NUMBER) // XXX
     292                {
    260293                        for (mlength_t i = 0; i < length; i++)
    261294                                at(index + i) = imsg.at(index + i);
     
    336369        }
    337370        boost::shared_ptr<imsg_t> imsg;
     371       
     372        // XXX Mario: Debugging
     373public:
     374        const std::string MAGIC_IDENTIFIER;
     375        const int MAGIC_NUMBER;
    338376};
    339377
Note: See TracChangeset for help on using the changeset viewer.