Changeset 10822


Ignore:
Timestamp:
May 25, 2011, 4:25:55 PM (9 years ago)
Author:
tbretz
Message:
Handle operation_aborted in timeouts; improved Connection::HandleSentData's output
File:
1 edited

Legend:

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

    r10780 r10822  
    123123void Connection::HandleWriteTimeout(const bs::error_code &error)
    124124{
     125    if (error==ba::error::basic_errors::operation_aborted)
     126        return;
     127
    125128    // 125: Operation canceled (bs::error_code(125, bs::system_category))
    126     if (error && error!=ba::error::basic_errors::operation_aborted)
     129    if (error)
    127130    {
    128131        ostringstream str;
     
    155158void Connection::HandleSentData(const bs::error_code& error, size_t n)
    156159{
    157     if (error)
     160    if (error && error != ba::error::not_connected)
    158161    {
    159162        ostringstream str;
     
    165168    }
    166169
    167     ostringstream msg;
    168     msg << n << " bytes successfully sent to " << URL();
    169     Message(msg);
     170    if (error == ba::error::not_connected)
     171    {
     172        ostringstream msg;
     173        msg << n << " bytes could not be sent to " << URL() << " due to missing connection.";
     174        Warn(msg);
     175    }
     176    else
     177    {
     178        ostringstream msg;
     179        msg << n << " bytes successfully sent to " << URL();
     180        Message(msg);
     181    }
    170182
    171183    // This is "thread" safe because SendMessage and HandleSentMessage
     
    236248void Connection::HandleConnectionTimer(const bs::error_code &error)
    237249{
    238     // 125: Operation canceled
    239     if (error && error!=ba::error::basic_errors::operation_aborted)
     250    if (error==ba::error::basic_errors::operation_aborted)
     251        return;
     252
     253    if (error)
    240254    {
    241255        ostringstream str;
     
    286300    fConnectionStatus = kConnecting;
    287301
     302    // FIXME: "No route to host (syytem::113)" gives error:"Operation already in progress. (system:114)"
    288303    ostringstream msg;
    289304    if (!host.empty())
Note: See TracChangeset for help on using the changeset viewer.