blob: 232ef4dc7f9e92b28326a3bf3f8f903941e2c031 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
/* See LICENSE file for copyright and license details. */
#include "common.h"
libaxl_id_t
libaxl_generate_id(LIBAXL_CONTEXT *ctx)
{
LIBAXL_CONNECTION *conn = ctx->conn;
uint32_t id;
id = atomic_fetch_add(&conn->xid_last, 1);
if (id <= conn->xid_max)
return (id << conn->xid_shift) | conn->xid_base;
atomic_fetch_sub(&conn->xid_last, 1);
liberror_save_backtrace(NULL);
liberror_set_error("Request has been buffered and is ready to be sent",
"libaxl_generate_id", "libaxl", LIBAXL_ERROR_OUT_OF_RESOURCE_IDS);
return 0;
}
|