Changeset 3910:aecb34063151 in roaraudio
- Timestamp:
- 06/06/10 14:45:46 (14 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/clients.c
r3825 r3910 26 26 #include "roard.h" 27 27 28 #define _CHECK_CID_RET(id,ret) if ( (id) < 0 || (id) > ROAR_CLIENTS_MAX || g_clients[(id)] == NULL ) return (ret) 29 #define _CHECK_CID(id) _CHECK_CID_RET((id), -1) 30 28 31 int clients_init (void) { 29 32 int i; … … 39 42 40 43 for (i = 0; i < ROAR_CLIENTS_MAX; i++) 41 if ( g_clients[i] )44 if ( g_clients[i] != NULL ) 42 45 clients_delete(i); 43 46 … … 126 129 ROAR_DBG("clients_delete(id=%i) = ?", id); 127 130 128 if ( g_clients[id] == NULL ) 129 return -1; 131 _CHECK_CID(id); 130 132 131 133 if (g_clients[id]->execed != -1) { … … 152 154 153 155 int clients_get (int id, struct roar_client ** client) { 156 _CHECK_CID(id); 157 154 158 *client = g_clients[id]; 155 159 … … 167 171 #endif 168 172 173 _CHECK_CID(id); 174 169 175 if ( (c = g_clients[id]) == NULL ) 170 176 return -1; … … 192 198 193 199 int clients_get_fh (int id) { 194 if ( g_clients[id] == NULL ) 195 return -1; 200 _CHECK_CID(id); 196 201 197 202 return g_clients[id]->fh; … … 199 204 200 205 int clients_set_pid (int id, int pid) { 201 if ( g_clients[id] == NULL ) 202 return -1; 206 _CHECK_CID(id); 203 207 204 208 g_clients[id]->pid = pid; … … 208 212 209 213 int clients_set_uid (int id, int uid) { 210 if ( g_clients[id] == NULL ) 211 return -1; 214 _CHECK_CID(id); 212 215 213 216 g_clients[id]->uid = uid; … … 217 220 218 221 int clients_set_gid (int id, int gid) { 219 if ( g_clients[id] == NULL ) 220 return -1; 222 _CHECK_CID(id); 221 223 222 224 g_clients[id]->gid = gid; … … 228 230 int byteorder = ROAR_BYTEORDER_UNKNOWN; 229 231 230 if ( g_clients[id] == NULL ) 231 return -1; 232 _CHECK_CID(id); 232 233 233 234 switch (proto) { … … 412 413 int rv = 0; 413 414 414 if ( g_clients[id] == NULL )415 return -1; 415 _CHECK_CID(id); 416 416 417 if ( g_clients[id]->fh == -1 ) 417 418 return -1; … … 554 555 int i; 555 556 557 _CHECK_CID(client); 558 559 #if 0 556 560 if ( g_clients[client] == NULL ) { 557 561 ROAR_WARN("client_stream_exec(client=%i, stream=%i) = -1 // client does not exist", client, stream); 558 562 return -1; 559 563 } 564 #endif 560 565 561 566 for (i = 0; i < ROAR_CLIENTS_MAX_STREAMS_PER_CLIENT; i++) { … … 576 581 int i; 577 582 578 if ( g_clients[client] == NULL ) 579 return -1; 583 _CHECK_CID(client); 580 584 581 585 for (i = 0; i < ROAR_CLIENTS_MAX_STREAMS_PER_CLIENT; i++) { … … 592 596 int i; 593 597 594 if ( g_clients[client] == NULL ) 595 return -1; 598 _CHECK_CID(client); 596 599 597 600 for (i = 0; i < ROAR_CLIENTS_MAX_STREAMS_PER_CLIENT; i++) { … … 609 612 int i; 610 613 611 if ( g_clients[client] == NULL ) 612 return -1; 614 _CHECK_CID(client); 613 615 614 616 for (i = 0; i < ROAR_CLIENTS_MAX_STREAMS_PER_CLIENT; i++) { -
roard/network.c
r3802 r3910 100 100 client = clients_new(); 101 101 102 if ( client == -1 ) { 103 ROAR_DBG("net_get_new_client(void) = -1 // can not create new client"); 104 return -1; 105 } 106 102 107 if ( clients_set_fh(client, fh) == -1 ) { 103 108 ROAR_ERR("net_get_new_client(void): Can not set client's fh");
Note: See TracChangeset
for help on using the changeset viewer.