diff --git a/src/Connection.cpp b/src/Connection.cpp index 3baecf0..b44b7b1 100644 --- a/src/Connection.cpp +++ b/src/Connection.cpp @@ -283,9 +283,7 @@ bool TrueMQTT::Client::Impl::Connection::connectToAny() } // Check for at most 100ms if there is any activity on the sockets. - timeval timeout; - timeout.tv_sec = 0; - timeout.tv_usec = 100; + timeval timeout = {0, 100 * 1000}; fd_set write_fds; FD_ZERO(&write_fds); diff --git a/src/Packet.cpp b/src/Packet.cpp index 121ea7d..0cd8fcb 100644 --- a/src/Packet.cpp +++ b/src/Packet.cpp @@ -16,7 +16,7 @@ ssize_t TrueMQTT::Client::Impl::Connection::recv(char *buffer, size_t length) const { - // We idle-check every 10ms if we are requested to stop or if there was + // We idle-check every 100ms if we are requested to stop or if there was // an error. This is to prevent the recv() call from blocking forever. while (true) { @@ -24,7 +24,7 @@ ssize_t TrueMQTT::Client::Impl::Connection::recv(char *buffer, size_t length) co fd_set read_fds; FD_ZERO(&read_fds); FD_SET(m_socket, &read_fds); - timeval timeout = {0, 10}; + timeval timeout = {0, 100 * 1000}; size_t ret = select(m_socket + 1, &read_fds, nullptr, nullptr, &timeout); if (m_state == State::SOCKET_ERROR || m_state == State::STOP)