mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Add timeout to socket
This commit is contained in:
parent
b657c6b848
commit
726428a2c5
@ -139,7 +139,13 @@ void TaskStatsInfoGetter::init()
|
||||
if (netlink_socket_fd >= 0)
|
||||
return;
|
||||
|
||||
struct timeval tv;
|
||||
tv.tv_sec = 5;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
netlink_socket_fd = ::socket(PF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
|
||||
::setsockopt(netlink_socket_fd, SOL_SOCKET, SO_RCVTIMEO, reinterpret_cast<const char *>(&tv), sizeof(tv));
|
||||
|
||||
if (netlink_socket_fd < 0)
|
||||
throwFromErrno("Can't create PF_NETLINK socket");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user