diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-05-30 17:03:33 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-05-30 17:03:33 +0000 |
| commit | 6f8cef248e1467595a932707eb9a9c53af2e8839 (patch) | |
| tree | 14beaef0e6253ab3657b59a90231d2788806307a /src/idManager.c | |
| parent | 13cb3930e9989aba57f0301a821f64ceed29af20 (diff) | |
- opravene memory leaky pomocou vlagrindu
- sietovy protokol je navrhnuty tal aby client odsiselal info o tom, ze obdrzal spravu
git-svn-id: http://opensvn.csie.org/tuxanci_ng@57 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/idManager.c')
| -rw-r--r-- | src/idManager.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/idManager.c b/src/idManager.c index ef46433..9c866c9 100644 --- a/src/idManager.c +++ b/src/idManager.c @@ -8,10 +8,12 @@ #include "idManager.h" static list_t *listID; +static int lastID; void initListID() { listID = newList(); + lastID = 0; printf("init ID manger..\n"); } @@ -43,7 +45,13 @@ int getNewID() assert( listID != NULL ); do{ - ret = random() % MAX_ID + 1; + ret = ++lastID; + + if( lastID > MAX_ID ) + { + lastID = 0; + } + }while( isRegisterID(ret) != -1 ); addList(listID, newInt(ret) ); |