33        const char* errstr = strerror(errno);
 
   40    if (fcntl(source_, F_SETFD, FD_CLOEXEC)) {
 
   41        const char* errstr = strerror(errno);
 
   46    if (fcntl(sink_, F_SETFD, FD_CLOEXEC)) {
 
   47        const char* errstr = strerror(errno);
 
   52    if (fcntl(sink_, F_SETFL, O_NONBLOCK)) {
 
   53        const char* errstr = strerror(errno);
 
 
   68    if (fcntl(sink_, F_GETFL) < 0) {
 
   71                  " select_fd was closed!");
 
   76        if (nbytes != 
sizeof(
MARKER)) {
 
   80            const char* errstr = strerror(errno);
 
   83                      << 
" bytes written: " << nbytes << 
" : " << errstr);
 
 
   97    int result = ioctl(sink_, FIONREAD, &len);
 
   99    return ((result == 0) && (len > 0));
 
 
  106        int nbytes = read (sink_, &buf, 
sizeof(buf));
 
  111            const char* errstr = strerror(errno);
 
  114                      "bytes read: " << nbytes << 
" : " 
  115                      "value read: " << buf << 
" error :" << errstr);
 
 
  122    std::ostringstream s;
 
  128        if (close(source_)) {
 
  130            s << 
"Could not close source: " << strerror(errno);
 
  139            if (error_string.empty()) {
 
  140                s << 
"could not close sink: " << strerror(errno);
 
  147    error_string = s.str();
 
  150    return (error_string.empty() ? 
true : 
false);
 
 
  155    std::string error_string;
 
Exception thrown if an error occurs during IO source open.
static const int SOCKET_NOT_VALID
Value used to signify an invalid descriptor.
static const uint32_t MARKER
Value written to the source when marking the socket as ready.
void clearReady()
Clears the socket's ready to read marker.
WatchSocket()
Constructor.
bool closeSocket(std::string &error_string)
Closes the descriptors associated with the socket.
virtual ~WatchSocket()
Destructor.
int getSelectFd()
Returns the file descriptor to use to monitor the socket.
bool isReady()
Returns true the if socket is marked as ready.
void markReady()
Marks the select-fd as ready to read.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Defines the logger used by the top-level component of kea-lfc.
Defines the class, WatchSocket.