summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/frct.c
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2016-10-22 11:33:20 +0000
committerSander Vrijders <[email protected]>2016-10-22 11:33:20 +0000
commit727efbe0c5e61862a870c71a2857b28eece3d369 (patch)
tree881da180b8d801c38ba0fbad2fc9f387a70ec016 /src/ipcpd/normal/frct.c
parent482c44232d4deda3f89a7d85fbad99c1c64e80ec (diff)
parent3cafbf3cfe5c58a6988dbfc4c29148ebb804f5c2 (diff)
downloadouroboros-727efbe0c5e61862a870c71a2857b28eece3d369.tar.gz
ouroboros-727efbe0c5e61862a870c71a2857b28eece3d369.zip
Merged in dstaesse/ouroboros/be-extra (pull request #268)
build: Comply with -Wextra compiler flag
Diffstat (limited to 'src/ipcpd/normal/frct.c')
-rw-r--r--src/ipcpd/normal/frct.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/ipcpd/normal/frct.c b/src/ipcpd/normal/frct.c
index 9daf8755..3f80f91e 100644
--- a/src/ipcpd/normal/frct.c
+++ b/src/ipcpd/normal/frct.c
@@ -42,7 +42,7 @@ enum conn_state {
struct frct_i {
uint32_t cep_id;
- uint32_t r_address;
+ uint64_t r_address;
uint32_t r_cep_id;
enum qos_cube cube;
uint64_t seqno;
@@ -58,18 +58,20 @@ struct {
pthread_mutex_t cep_ids_lock;
} frct;
-static int next_cep_id()
+static cep_id_t next_cep_id(void)
{
- int ret;
+ cep_id_t ret;
pthread_mutex_lock(&frct.cep_ids_lock);
ret = bmp_allocate(frct.cep_ids);
+ if (!bmp_is_id_valid(frct.cep_ids, ret))
+ ret = INVALID_CEP_ID;
pthread_mutex_unlock(&frct.cep_ids_lock);
return ret;
}
-static int release_cep_id(int id)
+static int release_cep_id(cep_id_t id)
{
int ret;
@@ -117,7 +119,7 @@ int frct_fini()
return 0;
}
-static struct frct_i * create_frct_i(uint32_t address,
+static struct frct_i * create_frct_i(uint64_t address,
cep_id_t r_cep_id)
{
struct frct_i * instance;
@@ -128,6 +130,11 @@ static struct frct_i * create_frct_i(uint32_t address,
return NULL;
id = next_cep_id();
+ if (id == INVALID_CEP_ID) {
+ free(instance);
+ return NULL;
+ }
+
instance->r_address = address;
instance->cep_id = id;
instance->r_cep_id = r_cep_id;
@@ -191,7 +198,7 @@ static void destroy_frct_i(struct frct_i * instance)
free(instance);
}
-cep_id_t frct_i_create(uint32_t address,
+cep_id_t frct_i_create(uint64_t address,
buffer_t * buf,
enum qos_cube cube)
{