+bool SimpleClient::response(libtest::vchar_t& response_)
+{
+ response_.clear();
+
+ if (is_valid())
+ {
+ if (ready(POLLIN))
+ {
+ bool more= true;
+ char buffer[2];
+ buffer[1]= 0;
+ do
+ {
+ ssize_t nr= recv(sock_fd, buffer, 1, MSG_NOSIGNAL);
+ if (nr == -1)
+ {
+ if (errno != EINTR)
+ {
+ _error= strerror(errno);
+ return false;
+ }
+ }
+ else if (nr == 0)
+ {
+ close_socket();
+ more= false;
+ }
+ else
+ {
+ response_.reserve(response_.size() + nr +1);
+ fatal_assert(nr == 1);
+ if (buffer[0] == '\n')
+ {
+ more= false;
+ }
+ response_.insert(response_.end(), buffer, buffer +nr);
+ }
+ } while (more);
+
+ return response_.size();
+ }
+ }
+
+ fatal_assert(_error.size());
+ return false;
+}
+