Drop packet if there are not enough free buffers to perform fragmentation

This commit is contained in:
Laurent Deru 2013-09-02 16:19:08 +02:00
parent 8b72ab49c0
commit 68b9412776
5 changed files with 34 additions and 1 deletions

View file

@ -107,5 +107,18 @@ memb_inmemb(struct memb *m, void *ptr)
(char *)ptr < (char *)m->mem + (m->num * m->size);
}
/*---------------------------------------------------------------------------*/
int
memb_numfree(struct memb *m)
{
int i;
int num_free = 0;
for(i = 0; i < m->num; ++i) {
if(m->count[i] == 0) {
++num_free;
}
}
return num_free;
}
/** @} */