- const int n = 4;
- const int p = 1;
- int chunk = ksocknal_data.ksnd_peer_hash_size;
-
- /* Time to check for timeouts on a few more peers: I do
- * checks every 'p' seconds on a proportion of the peer_ni
- * table and I need to check every connection 'n' times
- * within a timeout interval, to ensure I detect a
- * timeout on any connection within (n+1)/n times the
- * timeout interval. */
-
- if (*ksocknal_tunables.ksnd_timeout > n * p)
- chunk = (chunk * n * p) /
- *ksocknal_tunables.ksnd_timeout;
- if (chunk == 0)
- chunk = 1;
-
- for (i = 0; i < chunk; i++) {
- ksocknal_check_peer_timeouts (peer_index);
- peer_index = (peer_index + 1) %
- ksocknal_data.ksnd_peer_hash_size;
- }
+ const int n = 4;
+ const int p = 1;
+ int chunk = HASH_SIZE(ksocknal_data.ksnd_peers);
+ unsigned int lnd_timeout;
+
+ /* Time to check for timeouts on a few more peers: I
+ * do checks every 'p' seconds on a proportion of the
+ * peer_ni table and I need to check every connection
+ * 'n' times within a timeout interval, to ensure I
+ * detect a timeout on any connection within (n+1)/n
+ * times the timeout interval.
+ */
+
+ lnd_timeout = lnet_get_lnd_timeout();
+ if (lnd_timeout > n * p)
+ chunk = (chunk * n * p) / lnd_timeout;
+ if (chunk == 0)
+ chunk = 1;
+
+ for (i = 0; i < chunk; i++) {
+ ksocknal_check_peer_timeouts(peer_index);
+ peer_index = (peer_index + 1) %
+ HASH_SIZE(ksocknal_data.ksnd_peers);
+ }