Function esp_idf_svc::sys::httpd_sess_update_lru_counter

source ยท
pub unsafe extern "C" fn httpd_sess_update_lru_counter(
    handle: *mut c_void,
    sockfd: i32,
) -> i32
Expand description

@brief Update LRU counter for a given socket

LRU Counters are internally associated with each session to monitor how recently a session exchanged traffic. When LRU purge is enabled, if a client is requesting for connection but maximum number of sockets/sessions is reached, then the session having the earliest LRU counter is closed automatically.

Updating the LRU counter manually prevents the socket from being purged due to the Least Recently Used (LRU) logic, even though it might not have received traffic for some time. This is useful when all open sockets/session are frequently exchanging traffic but the user specifically wants one of the sessions to be kept open, irrespective of when it last exchanged a packet.

@note Calling this API is only necessary if the LRU Purge Enable option is enabled.

@param[in] handle Handle to server returned by httpd_start @param[in] sockfd The socket descriptor of the session for which LRU counter is to be updated

@return

  • ESP_OK : Socket found and LRU counter updated
  • ESP_ERR_NOT_FOUND : Socket not found
  • ESP_ERR_INVALID_ARG : Null arguments