Changeset 3737:e79803f4911d in roaraudio for roard
- Timestamp:
- 04/26/10 13:55:19 (14 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roard
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/clients.c
r3713 r3737 91 91 } 92 92 93 int clients_new_from_fh(int fh, int proto, int byteorder, int update_nnode) { 94 struct roar_client * c; 95 int client; 96 97 if ( fh == -1 ) 98 return -1; 99 100 if ( proto != ROAR_PROTO_ROARAUDIO || byteorder != ROAR_BYTEORDER_NETWORK ) 101 return -1; 102 103 if ( (client = clients_new()) == -1 ) 104 return -1; 105 106 if ( clients_set_fh(client, fh) == -1 ) { 107 clients_delete(client); 108 return -1; 109 } 110 111 if ( update_nnode ) { 112 if ( clients_get(client, &c) != -1 ) { 113 if ( roar_nnode_free(&(c->nnode)) != -1 ) { 114 roar_nnode_new_from_fh(&(c->nnode), fh, 1); 115 } 116 } 117 } 118 119 return 0; 120 } 121 93 122 int clients_delete (int id) { 94 123 int i; -
roard/include/client.h
r3517 r3737 52 52 // basic functions 53 53 54 int clients_init (void); 55 int clients_free (void); 56 int clients_new (void); 57 int clients_delete (int id); 58 int clients_set_fh (int id, int fh); 59 int clients_set_pid (int id, int pid); 60 int clients_set_uid (int id, int uid); 61 int clients_set_gid (int id, int gid); 62 int clients_set_name (int id, char * name); 63 int clients_set_proto (int id, int proto); 64 int clients_get (int id, struct roar_client ** client); 65 int clients_get_fh (int id); 54 int clients_init (void); 55 int clients_free (void); 56 int clients_new (void); 57 int clients_new_from_fh(int fh, int proto, int byteorder, int update_nnode); 58 int clients_delete (int id); 59 int clients_set_fh (int id, int fh); 60 int clients_set_pid (int id, int pid); 61 int clients_set_uid (int id, int uid); 62 int clients_set_gid (int id, int gid); 63 int clients_set_name (int id, char * name); 64 int clients_set_proto (int id, int proto); 65 int clients_get (int id, struct roar_client ** client); 66 int clients_get_fh (int id); 66 67 67 68 // network functions -
roard/req.c
r3734 r3737 291 291 292 292 int req_on_passfh (int client, struct roar_message * mes, char * data) { 293 struct roar_client * c;294 293 int sock = clients_get_fh(client); 295 294 int16_t * d = (int16_t*)mes->data; … … 351 350 lsock->proto = d[2]; 352 351 } else { 353 if ( d[2] != ROAR_PROTO_ROARAUDIO ) // protocol 354 return -1; 355 356 if ( d[3] != ROAR_BYTEORDER_NETWORK ) // byte order 357 return -1; 358 359 if ( (client = clients_new()) == -1 ) 360 return -1; 361 362 if ( clients_set_fh(client, fh) == -1 ) { 363 clients_delete(client); 364 return -1; 365 } 366 367 if ( clients_get(client, &c) != -1 ) { 368 roar_nnode_new_from_fh(&(c->nnode), fh, 1); 369 } 352 if ( clients_new_from_fh(fh, d[2], d[3], 1) == -1 ) 353 return -1; 370 354 } 371 355 -
roard/roard.c
r3733 r3737 1563 1563 #endif 1564 1564 } else if ( strcmp(k, "--client-fh") == 0 ) { 1565 if ( clients_ set_fh(clients_new(), atoi(argv[++i])) == -1 ) {1565 if ( clients_new_from_fh(atoi(argv[++i]), ROAR_PROTO_ROARAUDIO, ROAR_BYTEORDER_NETWORK, 1) == -1 ) { 1566 1566 ROAR_ERR("main(*): Can not set client's fh"); 1567 1567 return 1;
Note: See TracChangeset
for help on using the changeset viewer.