MCPcopy Create free account
hub / github.com/XTXMarkets/ternfs / block_socket_check_timeout

Function block_socket_check_timeout

kmod/block.c:405–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403}
404
405inline bool block_socket_check_timeout(struct block_socket* socket, u64 now, u64 timeout_jiffies) {
406 ternfs_debug("socket(%p) %pI4:%d refcount %d check timeout triggered", socket, &socket->addr.sin_addr, ntohs(socket->addr.sin_port), atomic_read(&socket->refcount));
407 // if something is locked activity in progress, nothing to do
408 if (!spin_trylock_bh(&socket->list_lock)) {
409 return false;
410 }
411 u64 last_activity = max(socket->last_read_activity, socket->last_write_activity);
412 bool timed_out = now - min(now, last_activity) > timeout_jiffies;
413 if (timed_out) {
414 atomic_cmpxchg(&socket->err, 0, -ETIMEDOUT);
415 }
416 spin_unlock_bh(&socket->list_lock);
417 return timed_out;
418}
419
420// Call periodically to check for inactive ones and schedules work on them to potentially time them out
421static void timeout_sockets(struct block_ops* ops) {

Callers 1

timeout_socketsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected