38 void (*handler) (
Buffer* b,
size_t size),
42 DEBUG(
"Async operation started with buffer*");
70 void (*handler) (
void* b,
size_t size),
71 void* buff,
size_t size)
74 DEBUG(
"Async operation started with void*");
98 DEBUG(
"Worker running");
100 DEBUG(
"===================");
106 DEBUG(
"Found one item in queue");
107 DEBUG(
"Need to read " << j->
size_ <<
" bytes");
108 DEBUG(
"File descriptor = " << des_->getDescriptorNumber());
119 ERROR(
"Handler called without operation!");
120 throw std::runtime_error (
"Async error");
122 DEBUG(
"Read " << n <<
" bytes");
124 DEBUG(
"Calling handler");
133 DEBUG(
"No data in queue");
158 size_t remaining = size;
159 while (remaining > 0) {
160 ssize_t ret =
::read (
fd_, ((
char*)buffer)+(size-remaining),
166 throw std::runtime_error (
"Read error");
171 return (size-remaining);
187 ERROR(
"Buffer size not enough!");
226 size_t remaining = size;
227 while (remaining > 0) {
229 ((
char*)buffer)+(size-remaining), remaining);
234 throw std::runtime_error (
"Write error");
239 return (size-remaining);
254 ERROR(
"Buffer size not enough!");
284 return do_write(reinterpret_cast<const void*> (s.c_str()), s.size());