Changeset 3978:8db545e91485 in roaraudio for plugins


Ignore:
Timestamp:
06/27/10 22:00:50 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

wrote first simple emul_rplay_check_client() function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/roard/protocol-rplay.c

    r3976 r3978  
    7070 
    7171 
    72 int emul_rplay_check_client  (int client, struct roar_vio_calls * vio); 
     72int emul_rplay_check_client  (int client, struct roar_vio_calls * vio) { 
     73 struct roar_vio_calls calls; 
     74 char buf[1024]; 
     75 ssize_t len; 
     76 
     77 if ( client == -1 ) 
     78  return -1; 
     79 
     80 if ( vio == NULL ) { 
     81  vio = &calls; 
     82  if ( roar_vio_open_fh_socket(vio, clients_get_fh(client)) == -1 ) 
     83   return -1; 
     84 } 
     85 
     86 if ( (len = roar_vio_read(vio, buf, sizeof(buf)-1)) <= 0 ) { 
     87  // really bad protocol error 
     88  clients_delete(client); 
     89  return -1; 
     90 } 
     91 
     92 for (; buf[len-1] == '\r' || buf[len-1] == '\n'; len--); 
     93 
     94 buf[len] = 0; 
     95 
     96 return emul_rplay_exec_command(client, vio, buf); 
     97} 
    7398 
    7499int emul_rplay_exec_command  (int client, struct roar_vio_calls * vio, char * command) { 
Note: See TracChangeset for help on using the changeset viewer.