Skip to content

Commit

Permalink
API to see if the fifo is full
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Jan 5, 2025
1 parent 9066381 commit 128d2fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/include/libradius.h
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,7 @@ int fr_fifo_push(fr_fifo_t *fi, void *data);
void *fr_fifo_pop(fr_fifo_t *fi);
void *fr_fifo_peek(fr_fifo_t *fi);
unsigned int fr_fifo_num_elements(fr_fifo_t *fi);
bool fr_fifo_full(fr_fifo_t *fi);

/*
* socket.c
Expand Down
7 changes: 7 additions & 0 deletions src/lib/fifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ unsigned int fr_fifo_num_elements(fr_fifo_t *fi)
return fi->num;
}

bool fr_fifo_full(fr_fifo_t *fi)
{
if (!fi) return true;

return (fi->num >= fi->max);
}

#ifdef TESTING

/*
Expand Down

0 comments on commit 128d2fb

Please sign in to comment.