Changeset 10823 for trunk


Ignore:
Timestamp:
05/25/11 16:26:56 (14 years ago)
Author:
tbretz
Message:
Handle operation_aborted in timeouts; multiply timestamp by 10000; removed obsolete deadline_ data member
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/ftm.cc

    r10748 r10823  
    5757    }
    5858
    59     ba::deadline_timer deadline_;
    60 
    6159    ba::deadline_timer fTriggerDynData;
    6260
    6361    // The constructor is prvate to force the obtained pointer to be shared
    6462    tcp_connection(ba::io_service& ioservice) : ba::ip::tcp::socket(ioservice),
    65         deadline_(ioservice), fTriggerDynData(ioservice)
    66     {
    67         deadline_.expires_at(boost::posix_time::pos_infin);
     63        fTriggerDynData(ioservice)
     64    {
     65        //deadline_.expires_at(boost::posix_time::pos_infin);
    6866
    6967        fHeader.fDelimiter=kDelimiterStart;
     
    178176        fHeader.fDataSize=sizeof(FTM::DynamicData)/2+1;
    179177        fHeader.fTriggerCounter = fCounter++;
    180         fHeader.fTimeStamp = fTimeStamp++;//lrint(Time().UnixTime());
     178        fHeader.fTimeStamp = fTimeStamp++*1000000;//lrint(Time().UnixTime());
    181179
    182180        fBufHeader      = fHeader.HtoN();
     
    193191        fHeader.fDataSize=sizeof(FTM::StaticData)/2+1;
    194192        fHeader.fTriggerCounter = fCounter++;
    195         fHeader.fTimeStamp = fTimeStamp;//lrint(Time().UnixTime());
     193        fHeader.fTimeStamp = fTimeStamp*1000000;//lrint(Time().UnixTime());
    196194
    197195        for (int i=0; i<4; i++)
     
    213211            // Close the connection
    214212            close();
    215             deadline_.cancel();
    216213            return;
    217214        }
     
    246243                fHeader.fDataSize=sizeof(FTM::FtuList)/2+1;
    247244                fHeader.fTriggerCounter = fCounter++;
    248                 fHeader.fTimeStamp = fTimeStamp;//lrint(Time().UnixTime());
     245                fHeader.fTimeStamp = fTimeStamp*1000000;//lrint(Time().UnixTime());
    249246
    250247                fFtuList[1].fPingAddr = ((rand()&1)<<9) | 1;
     
    369366                fHeader.fDataSize=2;
    370367                fHeader.fTriggerCounter = fCounter++;
    371                 fHeader.fTimeStamp = fTimeStamp;//lrint(Time().UnixTime());
     368                fHeader.fTimeStamp = fTimeStamp*1000000;//lrint(Time().UnixTime());
    372369
    373370                fBufHeader = fHeader.HtoN();
     
    410407    }
    411408
    412     void check_deadline(const boost::system::error_code &)
     409    void SendDynData(const boost::system::error_code &)
    413410    {
    414411        if (!is_open())
     
    419416        }
    420417
     418        if (ec==ba::error::basic_errors::operation_aborted)
     419            return;
     420
    421421        // Check whether the deadline has passed. We compare the deadline
    422422        // against the current time since a new asynchronous operation
    423423        // may have moved the deadline before this actor had a chance
    424424        // to run.
    425         if (deadline_.expires_at() <= ba::deadline_timer::traits_type::now())
    426         {
    427             // The deadline has passed. Stop the session. The other
    428             // actors will terminate as soon as possible.
    429 //            AsyncWrite(ba::buffer(ba::const_buffer(&fHeader, sizeof(FTM::Header))));
    430 //            AsyncWait(deadline_, 3, &tcp_connection::check_deadline);
    431 
    432             return;
    433         }
    434 
    435         AsyncWait(deadline_, 3, &tcp_connection::check_deadline);
    436     }
    437 
    438     void SendDynData(const boost::system::error_code &)
    439     {
    440         if (!is_open())
    441         {
    442             // For example: Here we could schedule a new accept if we
    443             // would not want to allow two connections at the same time.
    444             return;
    445         }
    446 
    447         // Check whether the deadline has passed. We compare the deadline
    448         // against the current time since a new asynchronous operation
    449         // may have moved the deadline before this actor had a chance
    450         // to run.
    451         if (deadline_.expires_at() <= ba::deadline_timer::traits_type::now())
     425
     426        if (fTriggerDynData.expires_at() > ba::deadline_timer::traits_type::now())
    452427            return;
    453428
     
    456431
    457432        AsyncWait(fTriggerDynData, 1, &tcp_connection::SendDynData);
    458         return;
    459433    }
    460434
Note: See TracChangeset for help on using the changeset viewer.