Changeset 4683:9d58aba09f3e in roaraudio


Ignore:
Timestamp:
12/22/10 02:59:45 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

do not kick clients of registered protos on connect...

Location:
roard
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • roard/clients.c

    r4679 r4683  
    2626#include "roard.h" 
    2727 
    28 struct roard_proto g_proto[8] = { 
     28struct roard_proto g_proto[MAX_PROTOS] = { 
    2929#ifndef ROAR_WITHOUT_DCOMP_EMUL_ESD 
    3030#ifdef ROAR_HAVE_H_ESD 
    31  {ROAR_PROTO_ESOUND, emul_esd_check_client}, 
     31 {ROAR_PROTO_ESOUND, NULL, emul_esd_check_client}, 
    3232#endif 
    3333#endif 
    3434#ifndef ROAR_WITHOUT_DCOMP_EMUL_RPLAY 
    35  {ROAR_PROTO_RPLAY, emul_rplay_check_client}, 
     35 {ROAR_PROTO_RPLAY, NULL, emul_rplay_check_client}, 
    3636#endif 
    3737 {-1, NULL} 
  • roard/include/client.h

    r4679 r4683  
    6969} * g_clients[ROAR_CLIENTS_MAX]; 
    7070 
     71struct roard_listen; 
     72 
    7173struct roard_proto { 
    7274 int proto; 
     75 int (*new_client)(int client, struct roar_vio_calls * vio, struct roard_listen * lsock); 
    7376 int (*check_client)(int client, struct roar_vio_calls * vio); 
    7477}; 
     78 
     79#define MAX_PROTOS 8 
     80struct roard_proto g_proto[MAX_PROTOS]; 
    7581 
    7682// basic functions 
  • roard/network.c

    r4228 r4683  
    7777 struct sockaddr_storage  addr; 
    7878 socklen_t                addrlen = sizeof(addr); 
     79 size_t i; 
     80 int supported = 0; 
    7981 
    8082 if ( roar_vio_ctl(&(lsock->sock), ROAR_VIO_CTL_GET_FH, &socket) == -1 ) { 
     
    188190    if ( roar_vio_open_fh_socket(&vio, fh) == -1 ) 
    189191     return -1; 
    190     roar_vio_close(&vio); 
    191     return -1; 
     192 
     193    for (i = 0; g_proto[i].proto != -1; i++) { 
     194     printf("g_proto[i=%i].proto=%i, lsock->proto=%i\n", (int)i, g_proto[i].proto, lsock->proto); 
     195     if ( g_proto[i].proto == lsock->proto ) { 
     196      supported = 1; 
     197      if ( g_proto[i].new_client != NULL ) { 
     198       if ( g_proto[i].new_client(client, &vio, lsock) == -1 ) { 
     199        supported = 0; 
     200       } 
     201      } 
     202     } 
     203    } 
     204 
     205    if ( !supported ) { 
     206     clients_delete(client); 
     207     //roar_vio_close(&vio); 
     208     return -1; 
     209    } 
    192210   break; 
    193211 } 
Note: See TracChangeset for help on using the changeset viewer.