Changeset 2517:183f9b04d767 in roaraudio
- Timestamp:
- 09/01/09 15:23:53 (15 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/clients.c
r1905 r2517 61 61 *n->host = 0; 62 62 63 n->proto = ROAR_PROTO_ROARAUDIO; 64 63 65 n->acl = NULL; 64 66 … … 158 160 159 161 g_clients[id]->gid = gid; 162 163 return 0; 164 } 165 166 int clients_set_proto (int id, int proto) { 167 if ( g_clients[id] == NULL ) 168 return -1; 169 170 g_clients[id]->proto = proto; 160 171 161 172 return 0; … … 335 346 roar_connect_fh(&con, g_clients[id]->fh); 336 347 337 r = roar_recv_message(&con, &m, &data); 338 339 if ( r == -1 ) { // should we drop the client? 340 clients_delete(id); 341 return -1; 342 } 343 344 roar_debug_message_print(&m); 345 346 oldcmd = m.cmd; 347 348 if ( (r = command_exec(id, &m, data)) == -1 ) { 349 m.cmd = ROAR_CMD_ERROR; 350 m.datalen = 0; 351 ROAR_DBG("clients_check(*): Exec of command faild!"); 352 } else { 353 if ( m.cmd == oldcmd ) { 354 m.cmd = ROAR_CMD_OK; 355 m.datalen = 0; 356 } else if ( m.cmd == ROAR_CMD_OK_STOP ) { 357 m.cmd = ROAR_CMD_OK; 358 rv = 1; 359 } 360 } 361 362 roar_send_message(&con, &m, NULL); 348 switch (g_clients[id]->proto) { 349 case ROAR_PROTO_ROARAUDIO: 350 r = roar_recv_message(&con, &m, &data); 351 352 if ( r == -1 ) { // should we drop the client? 353 clients_delete(id); 354 return -1; 355 } 356 357 roar_debug_message_print(&m); 358 359 oldcmd = m.cmd; 360 361 if ( (r = command_exec(id, &m, data)) == -1 ) { 362 m.cmd = ROAR_CMD_ERROR; 363 m.datalen = 0; 364 ROAR_DBG("clients_check(*): Exec of command faild!"); 365 } else { 366 if ( m.cmd == oldcmd ) { 367 m.cmd = ROAR_CMD_OK; 368 m.datalen = 0; 369 } else if ( m.cmd == ROAR_CMD_OK_STOP ) { 370 m.cmd = ROAR_CMD_OK; 371 rv = 1; 372 } 373 } 374 375 roar_send_message(&con, &m, NULL); 376 break; 377 default: 378 rv = -1; 379 } 363 380 364 381 if ( data ) 365 382 free(data); 366 383 367 ROAR_DBG("clients_check(id=%i) = 0", id);384 ROAR_DBG("clients_check(id=%i) = %i", id, rv); 368 385 return rv; 369 386 } -
roard/include/client.h
r767 r2517 60 60 int clients_set_gid (int id, int gid); 61 61 int clients_set_name (int id, char * name); 62 int clients_set_proto (int id, int proto); 62 63 int clients_get (int id, struct roar_client ** client); 63 64 int clients_get_fh (int id);
Note: See TracChangeset
for help on using the changeset viewer.