Changeset 3253:05670218c1d3 in roaraudio


Ignore:
Timestamp:
01/30/10 13:40:35 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

new network interface

Location:
roard
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • roard/include/network.h

    r2530 r3253  
    3030int net_check_listen  (void); 
    3131 
    32 int net_get_new_client (int sock, int proto); 
     32struct roard_listen; 
     33 
     34int net_get_new_client (struct roard_listen * lsock); 
    3335 
    3436#endif 
  • roard/include/roard.h

    r3207 r3253  
    130130 
    131131#ifdef ROAR_SUPPORT_LISTEN 
    132 struct { 
     132struct roard_listen { 
    133133 int socket; 
    134134 int proto; 
  • roard/network.c

    r3129 r3253  
    6565   if ( g_listen[i].socket != -1 ) { 
    6666    if ( FD_ISSET(g_listen[i].socket, &sl) ) { 
    67      if ( net_get_new_client(g_listen[i].socket, g_listen[i].proto) == -1 ) 
     67     if ( net_get_new_client(&(g_listen[i])) == -1 ) 
    6868      return -1; 
    6969    } 
     
    7979 
    8080#ifdef _CAN_OPERATE 
    81 int net_get_new_client (int sock, int proto) { 
     81int net_get_new_client (struct roard_listen * lsock) { 
    8282 int fh; 
    8383 int client; 
     
    9191 socklen_t                addrlen = sizeof(addr); 
    9292 
    93  fh = accept(sock, (struct sockaddr*)&addr, &addrlen); 
     93 fh = accept(lsock->socket, (struct sockaddr*)&addr, &addrlen); 
    9494 
    9595 ROAR_DBG("net_get_new_client(void): fh = %i", fh); 
     
    131131 } 
    132132 
    133  ROAR_DBG("net_get_new_client(*): proto=0x%.4x", proto); 
     133 ROAR_DBG("net_get_new_client(*): proto=0x%.4x", lsock->proto); 
    134134 
    135  if ( clients_set_proto(client, proto) == -1 ) { 
    136   ROAR_WARN("net_get_new_client(*): Setting proto(0x%.4x) of client %i failed.", proto, client); 
     135 if ( clients_set_proto(client, lsock->proto) == -1 ) { 
     136  ROAR_WARN("net_get_new_client(*): Setting proto(0x%.4x) of client %i failed.", lsock->proto, client); 
    137137  return -1; 
    138138 } 
    139139 
    140  switch (proto) { 
     140 switch (lsock->proto) { 
    141141  case ROAR_PROTO_ROARAUDIO: 
    142142    // nothing needed to be done here 
     
    158158   break; 
    159159#endif 
     160  case ROAR_PROTO_SIMPLE: 
     161   break; 
    160162#endif 
    161163  default: 
Note: See TracChangeset for help on using the changeset viewer.