Changeset 5606:f7617b41972e in roaraudio for roard/clients.c


Ignore:
Timestamp:
07/31/12 02:33:55 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Updated common protocol interface (Closes: #257, #256)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/clients.c

    r5590 r5606  
    143143                         struct roard_listen * lsock, struct sockaddr * sockaddr, socklen_t addrlen) { 
    144144 const struct roard_proto_handle * protohandle; 
     145 struct roar_dl_librarypara * pluginpara; 
    145146 struct roar_vio_calls    vio; 
    146147 struct roar_client_server * cs; 
     
    287288        supported = 1; 
    288289        if ( protohandle->impl.common->set_proto != NULL ) { 
    289          if ( protohandle->impl.common->set_proto(client, &vio, &(cs->outbuf), &(cs->protoinst), protohandle->para, protohandle->paralen) == -1 ) { 
     290         pluginpara = roar_dl_getpara(protohandle->lhandle); // will return NULL in case protohandle->lhandle is NULL. 
     291         if ( protohandle->impl.common->set_proto(client, &vio, &(cs->outbuf), &(cs->protoinst), protohandle->para, protohandle->paralen, pluginpara) == -1 ) { 
    290292          supported = 0; 
    291293         } 
     294         if ( pluginpara != NULL ) 
     295          roar_dl_para_unref(pluginpara); 
    292296        } 
    293297       break; 
     
    312316 struct roar_client_server * cs; 
    313317 const struct roard_proto_handle * proto; 
     318 struct roar_dl_librarypara * pluginpara; 
    314319 struct roar_vio_calls vio; 
    315320 int i; 
     
    337342     if ( proto->impl.common->unset_proto != NULL ) { 
    338343      roar_vio_open_fh_socket(&vio, clients_get_fh(id)); 
    339       proto->impl.common->unset_proto(id, &vio, &(cs->outbuf), &(cs->protoinst), proto->para, proto->paralen); 
     344      pluginpara = roar_dl_getpara(proto->lhandle); // will return NULL in case protohandle->lhandle is NULL. 
     345      proto->impl.common->unset_proto(id, &vio, &(cs->outbuf), &(cs->protoinst), proto->para, proto->paralen, pluginpara); 
     346      if ( pluginpara != NULL ) 
     347       roar_dl_para_unref(pluginpara); 
    340348     } 
    341349    break; 
     
    723731 struct roar_error_state errstate; 
    724732 const struct roard_proto_handle * proto; 
     733 struct roar_dl_librarypara * pluginpara; 
    725734 int command_error; 
    726735 char * data = NULL; 
     
    834843       break; 
    835844      case ROARD_PROTO_TYPE_COMMON: 
    836         if ( proto->impl.common->handle != NULL ) 
    837          rv = proto->impl.common->handle(id, &vio, &(cs->outbuf), &(cs->protoinst), proto->para, proto->paralen); 
     845        if ( proto->impl.common->handle != NULL ) { 
     846         pluginpara = roar_dl_getpara(proto->lhandle); // will return NULL in case protohandle->lhandle is NULL. 
     847         rv = proto->impl.common->handle(id, &vio, &(cs->outbuf), &(cs->protoinst), proto->para, proto->paralen, pluginpara); 
     848         if ( pluginpara != NULL ) 
     849          roar_dl_para_unref(pluginpara); 
     850        } 
    838851        if ( rv == -1 ) 
    839852         rv = clients_delete(id); 
     
    858871 struct roar_client              * c; 
    859872 const struct roard_proto_handle * p; 
     873 struct roar_dl_librarypara * pluginpara; 
    860874 size_t len; 
    861875 ssize_t ret; 
     
    892906     if ( p->lhandle != NULL ) 
    893907      roar_dl_context_restore(p->lhandle); 
    894      rv = p->impl.common->flush(id, &vio, &(cs->outbuf), &(cs->protoinst), p->para, p->paralen); 
     908     pluginpara = roar_dl_getpara(p->lhandle); // will return NULL in case protohandle->lhandle is NULL. 
     909     rv = p->impl.common->flush(id, &vio, &(cs->outbuf), &(cs->protoinst), p->para, p->paralen, pluginpara); 
    895910     if ( p->lhandle != NULL ) 
    896911      roar_dl_context_store(p->lhandle); 
     912     if ( pluginpara != NULL ) 
     913      roar_dl_para_unref(pluginpara); 
    897914     if ( rv == -1 ) 
    898915      rv = clients_delete(id); 
     
    946963      if ( p->lhandle != NULL ) 
    947964       roar_dl_context_restore(p->lhandle); 
    948       rv = p->impl.common->flushed(id, &vio, &(cs->outbuf), &(cs->protoinst), p->para, p->paralen); 
     965      pluginpara = roar_dl_getpara(p->lhandle); // will return NULL in case protohandle->lhandle is NULL. 
     966      rv = p->impl.common->flushed(id, &vio, &(cs->outbuf), &(cs->protoinst), p->para, p->paralen, pluginpara); 
    949967      if ( p->lhandle != NULL ) 
    950968       roar_dl_context_store(p->lhandle); 
     969      if ( pluginpara != NULL ) 
     970       roar_dl_para_unref(pluginpara); 
    951971      if ( rv == -1 ) 
    952972       rv = clients_delete(id); 
Note: See TracChangeset for help on using the changeset viewer.