Changeset 5567:6ecf012d7063 in roaraudio for roard/network.c


Ignore:
Timestamp:
07/16/12 17:02:17 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

roard now tries to auto load missing protocols as plugins (Closes: #275)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/network.c

    r5381 r5567  
    7070 
    7171int net_get_new_client (struct roard_listen * lsock) { 
     72 const struct roard_proto_handle * proto; 
    7273 int fh; 
    7374 int client; 
     
    7778 struct sockaddr_storage  addr; 
    7879 socklen_t                addrlen = sizeof(addr); 
    79  size_t i; 
    8080 int supported = 0; 
    8181 
     
    191191     return -1; 
    192192 
    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 ) { 
     193    proto = clients_get_protohandle(lsock->proto); 
     194    supported = 0; 
     195    if ( proto != NULL ) { 
     196     switch (proto->type) { 
     197      case ROARD_PROTO_TYPE_BUILDIN: 
     198        //this should not end up here. 
     199        ROAR_WARN("net_get_new_client(lsock=%p): proto(%i) marked as buildin but isn't. BAD.", lsock, lsock->proto); 
    199200        supported = 0; 
    200        } 
    201       } 
     201       break; 
     202      case ROARD_PROTO_TYPE_ROARDPROTO: 
     203        supported = 1; 
     204        if ( proto->impl.roardproto.new_client != NULL ) { 
     205         if ( proto->impl.roardproto.new_client(client, &vio, lsock) == -1 ) { 
     206          supported = 0; 
     207         } 
     208        } 
     209       break; 
    202210     } 
    203211    } 
Note: See TracChangeset for help on using the changeset viewer.