Ticket #123: network_errors.patch

File network_errors.patch, 1.3 KB (added by Mark Hammond, 17 years ago)

as described

  • net/remoteserver.cc

     
    200200                throw Xapian::InvalidArgumentError(errmsg);
    201201            }
    202202            (this->*(dispatch[type]))(message);
     203        } catch (const Xapian::NetworkTimeoutError & e) {
     204            try {
     205                // We've had a timeout, so the client may not be listening, so
     206                // if we can't send the message right away, just exit and the
     207                // client will cope.
     208                RemoteConnection::send_message(REPLY_EXCEPTION, serialise_error(e), OmTime::now());
     209            } catch (...) {
     210            }
     211            // but this really isn't an 'error' - particularly when an 'idle'
     212            // timeout (maybe making this distinction is worthwhile?).  For
     213            // now, just close the connection and silently return - no
     214            // message will be logged.
     215            return;
     216        } catch (const Xapian::NetworkError) {
     217            // All other network errors mean we are fatally confused - we
     218            // can't recover from a single missed byte - so no point trying
     219            // to serialize the error. Let top-level handler log a message
     220            // before closing the connection.
     221            throw;
    203222        } catch (const Xapian::Error &e) {
    204223            // Propagate the exception across the connection, then return to
    205224            // the main message handling loop.