Will be used to clean up duplicated logic in the future.
}
}
+client_t *Client_find_by_session(int session_id)
+{
+ struct dlist *itr;
+
+ list_iterate(itr, &clients) {
+ client_t *client = list_get_entry(itr, client_t, node);
+
+ if (client->sessionId == session_id) {
+ return client;
+ }
+ }
+
+ return NULL;
+}
+
client_t *Client_find_by_fd(int fd)
{
struct dlist *itr;
void Client_token_free(client_t *client);
void Client_token_add(client_t *client, char *token_string);
+/**
+ * Retrieve the client that matches the given session ID.
+ * Returns NULL if there's no such client.
+ */
+client_t *Client_find_by_session(int session_id);
+
#endif