X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Scheduler%2FReadHelper.ct;h=981d9705cdc0ea3fd9f4593e57647258bf860fad;hb=c4c0c1809c65d2b369e7888895f95c09f82116b9;hp=3ac3df5f55a0d3e8364cddb878ad158ec1a2da52;hpb=85ab07d100a382467a42e19d741d403a7a96c951;p=senf.git diff --git a/Scheduler/ReadHelper.ct b/Scheduler/ReadHelper.ct index 3ac3df5..981d970 100644 --- a/Scheduler/ReadHelper.ct +++ b/Scheduler/ReadHelper.ct @@ -25,8 +25,8 @@ // Custom includes #include -#include "Utils/membind.hh" -#include "Utils/Exception.hh" +#include "../Utils/membind.hh" +#include "../Utils/Exception.hh" #include "Scheduler.hh" #define prefix_ @@ -43,7 +43,7 @@ prefix_ senf::ReadHelper::ReadHelper(Handle handle, std::string::size_ty // scheduler. This ensures, that the refcount is at least 1 as // long as the helper is registered with the scheduler. senf::Scheduler::instance() - .add(handle,boost::bind(&ReadHelper::dispatchProcess,ptr(this),_1,_2), + .add(handle,boost::bind(&ReadHelper::dispatchProcess,ptr(this), handle, _1), senf::Scheduler::EV_READ); } @@ -69,11 +69,11 @@ template prefix_ void senf::ReadHelper::process(Handle handle, senf::Scheduler::EventId event) { - /** \fixme Move the done() calls to outside the try/catch block */ try { if (event != senf::Scheduler::EV_READ) - throw SystemException(EPIPE); - std::string rcv (handle.read(maxSize_ - data_.size())); + throw SystemException(EPIPE SENF_EXC_DEBUGINFO); + std::string rcv; + handle.read(rcv, maxSize_ - data_.size()); data_.append(rcv); std::string::size_type n = predicate_ ? (*predicate_)(data_) : std::string::npos; if (n != std::string::npos || data_.size() >= maxSize_ || rcv.size() == 0) { @@ -82,13 +82,15 @@ prefix_ void senf::ReadHelper::process(Handle handle, tail_.assign(data_,n,std::string::npos); data_.erase(n); } - done(); } } catch (senf::SystemException const & ex) { - errno_ = ex.err; + errno_ = ex.errorNumber(); done(); + return; } + if (complete_) + done(); } template @@ -117,4 +119,6 @@ operator()(std::string const & data) // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 // End: