...
}
-When the library is loaded :iscman:`kea-dhcp4` will conduct ping-check prior to
+When the library is loaded :iscman:`kea-dhcp4` will conduct a ping-check prior to
offering a lease to client if all of the following conditions are true:
1. Ping check hook library is loaded.
The following parameter is only supported at the global level:
-- `ping-channel-threads` - In multi-threaded mode, this is the number of threads in the channel's thread pool. The default is 0 which instructs the library to use the same number of threads as Kea core.
+- `ping-channel-threads` - In multi-threaded mode, this is the number of threads in the channel's thread pool. The default is 0 which instructs the library to use the same number of threads as Kea core. The value is ignored if given when Kea is in single-threaded mode.
The following configuration excerpt illustrates global level configuration:
Ping checking is an experimental feature. It is not currently recommended for
production environments.
-
-.. note::
-
- Ping checking is currently only supported when Kea is configured for multi-threaded operation.
/// @param callback callback function
void addExternalSocket(int socketfd, SocketCallback callback);
+ /// @brief Checks if socket's file description is registered.
+ ///
+ /// @return True if the fd is in the list of registered sockets.
+ bool isExternalSocket(int fd);
+
/// @brief Deletes external socket
///
/// @param socketfd socket descriptor
// Create first pipe and register it as extra socket
int pipefd[2];
EXPECT_TRUE(pipe(pipefd) == 0);
+ ASSERT_FALSE(ifacemgr->isExternalSocket(pipefd[0]));
EXPECT_NO_THROW(ifacemgr->addExternalSocket(pipefd[0],
[&callback_ok, &pipefd](int fd) {
callback_ok = (pipefd[0] == fd);
}));
-
+ ASSERT_TRUE(ifacemgr->isExternalSocket(pipefd[0]));
// Let's create a second pipe and register it as well
int secondpipe[2];
EXPECT_TRUE(pipe(secondpipe) == 0);
+ ASSERT_FALSE(ifacemgr->isExternalSocket(secondpipe[0]));
EXPECT_NO_THROW(ifacemgr->addExternalSocket(secondpipe[0],
[&callback2_ok, &secondpipe](int fd) {
callback2_ok = (secondpipe[0] == fd);
}));
+ ASSERT_TRUE(ifacemgr->isExternalSocket(secondpipe[0]));
// Verify a call with no data and normal external sockets works ok.
Pkt4Ptr pkt4;
// Create first pipe and register it as extra socket
int pipefd[2];
EXPECT_TRUE(pipe(pipefd) == 0);
+ ASSERT_FALSE(ifacemgr->isExternalSocket(pipefd[0]));
EXPECT_NO_THROW(ifacemgr->addExternalSocket(pipefd[0],
[&callback_ok, &pipefd](int fd) {
callback_ok = (pipefd[0] == fd);
}));
-
+ ASSERT_TRUE(ifacemgr->isExternalSocket(pipefd[0]));
// Let's create a second pipe and register it as well
int secondpipe[2];
EXPECT_TRUE(pipe(secondpipe) == 0);
+ ASSERT_FALSE(ifacemgr->isExternalSocket(secondpipe[0]));
EXPECT_NO_THROW(ifacemgr->addExternalSocket(secondpipe[0],
[&callback2_ok, &secondpipe](int fd) {
callback2_ok = (secondpipe[0] == fd);
}));
+ ASSERT_TRUE(ifacemgr->isExternalSocket(secondpipe[0]));
// Verify a call with no data and normal external sockets works ok.
Pkt6Ptr pkt6;