Index: roard/clients.c
===================================================================
--- roard/clients.c	(revision 5590)
+++ roard/clients.c	(revision 5606)
@@ -143,4 +143,5 @@
                          struct roard_listen * lsock, struct sockaddr * sockaddr, socklen_t addrlen) {
  const struct roard_proto_handle * protohandle;
+ struct roar_dl_librarypara * pluginpara;
  struct roar_vio_calls    vio;
  struct roar_client_server * cs;
@@ -287,7 +288,10 @@
         supported = 1;
         if ( protohandle->impl.common->set_proto != NULL ) {
-         if ( protohandle->impl.common->set_proto(client, &vio, &(cs->outbuf), &(cs->protoinst), protohandle->para, protohandle->paralen) == -1 ) {
+         pluginpara = roar_dl_getpara(protohandle->lhandle); // will return NULL in case protohandle->lhandle is NULL.
+         if ( protohandle->impl.common->set_proto(client, &vio, &(cs->outbuf), &(cs->protoinst), protohandle->para, protohandle->paralen, pluginpara) == -1 ) {
           supported = 0;
          }
+         if ( pluginpara != NULL )
+          roar_dl_para_unref(pluginpara);
         }
        break;
@@ -312,4 +316,5 @@
  struct roar_client_server * cs;
  const struct roard_proto_handle * proto;
+ struct roar_dl_librarypara * pluginpara;
  struct roar_vio_calls vio;
  int i;
@@ -337,5 +342,8 @@
      if ( proto->impl.common->unset_proto != NULL ) {
       roar_vio_open_fh_socket(&vio, clients_get_fh(id));
-      proto->impl.common->unset_proto(id, &vio, &(cs->outbuf), &(cs->protoinst), proto->para, proto->paralen);
+      pluginpara = roar_dl_getpara(proto->lhandle); // will return NULL in case protohandle->lhandle is NULL.
+      proto->impl.common->unset_proto(id, &vio, &(cs->outbuf), &(cs->protoinst), proto->para, proto->paralen, pluginpara);
+      if ( pluginpara != NULL )
+       roar_dl_para_unref(pluginpara);
      }
     break;
@@ -723,4 +731,5 @@
  struct roar_error_state errstate;
  const struct roard_proto_handle * proto;
+ struct roar_dl_librarypara * pluginpara;
  int command_error;
  char * data = NULL;
@@ -834,6 +843,10 @@
        break;
       case ROARD_PROTO_TYPE_COMMON:
-        if ( proto->impl.common->handle != NULL )
-         rv = proto->impl.common->handle(id, &vio, &(cs->outbuf), &(cs->protoinst), proto->para, proto->paralen);
+        if ( proto->impl.common->handle != NULL ) {
+         pluginpara = roar_dl_getpara(proto->lhandle); // will return NULL in case protohandle->lhandle is NULL.
+         rv = proto->impl.common->handle(id, &vio, &(cs->outbuf), &(cs->protoinst), proto->para, proto->paralen, pluginpara);
+         if ( pluginpara != NULL )
+          roar_dl_para_unref(pluginpara);
+        }
         if ( rv == -1 )
          rv = clients_delete(id);
@@ -858,4 +871,5 @@
  struct roar_client              * c;
  const struct roard_proto_handle * p;
+ struct roar_dl_librarypara * pluginpara;
  size_t len;
  ssize_t ret;
@@ -892,7 +906,10 @@
      if ( p->lhandle != NULL )
       roar_dl_context_restore(p->lhandle);
-     rv = p->impl.common->flush(id, &vio, &(cs->outbuf), &(cs->protoinst), p->para, p->paralen);
+     pluginpara = roar_dl_getpara(p->lhandle); // will return NULL in case protohandle->lhandle is NULL.
+     rv = p->impl.common->flush(id, &vio, &(cs->outbuf), &(cs->protoinst), p->para, p->paralen, pluginpara);
      if ( p->lhandle != NULL )
       roar_dl_context_store(p->lhandle);
+     if ( pluginpara != NULL )
+      roar_dl_para_unref(pluginpara);
      if ( rv == -1 )
       rv = clients_delete(id);
@@ -946,7 +963,10 @@
       if ( p->lhandle != NULL )
        roar_dl_context_restore(p->lhandle);
-      rv = p->impl.common->flushed(id, &vio, &(cs->outbuf), &(cs->protoinst), p->para, p->paralen);
+      pluginpara = roar_dl_getpara(p->lhandle); // will return NULL in case protohandle->lhandle is NULL.
+      rv = p->impl.common->flushed(id, &vio, &(cs->outbuf), &(cs->protoinst), p->para, p->paralen, pluginpara);
       if ( p->lhandle != NULL )
        roar_dl_context_store(p->lhandle);
+      if ( pluginpara != NULL )
+       roar_dl_para_unref(pluginpara);
       if ( rv == -1 )
        rv = clients_delete(id);
