summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-08-27 06:45:38 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-08-27 05:53:56 -0700
commit8071909e84b6a479a6b5be1eddd15e8b16fc1a80 (patch)
treedb3a56cef557a3c86fd983e778927c70a8665363 /xlators/protocol/server
parentfd282c4299a5354aa272345e312ac600d9dcc680 (diff)
rpc: server to client callback mechanism
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
Diffstat (limited to 'xlators/protocol/server')
-rw-r--r--xlators/protocol/server/src/server.c13
-rw-r--r--xlators/protocol/server/src/server.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index 262da3e3158..8a7d9da0bbf 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -123,6 +123,10 @@ server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg,
ret = rpcsvc_submit_generic (req, &rsp, 1, payload, payloadcount,
iobref);
+ /* TODO: this is demo purpose only */
+ /* ret = rpcsvc_callback_submit (req->svc, req->trans, req->prog,
+ GF_CBK_NULL, &rsp, 1);
+ */
/* Now that we've done our job of handing the message to the RPC layer
* we can safely unref the iob in the hope that RPC layer must have
* ref'ed the iob on receiving into the txlist.
@@ -366,6 +370,7 @@ server_rpc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event,
xlator_t *this = NULL;
rpc_transport_t *xprt = NULL;
server_connection_t *conn = NULL;
+ server_conf_t *conf = NULL;
if (!xl || !data) {
@@ -376,6 +381,7 @@ server_rpc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event,
this = xl;
xprt = data;
+ conf = this->private;
switch (event) {
case RPCSVC_EVENT_ACCEPT:
@@ -388,6 +394,10 @@ server_rpc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event,
xprt->protocol_private = conn;
*/
+ INIT_LIST_HEAD (&xprt->list);
+
+ list_add_tail (&xprt->list, &conf->xprt_list);
+
break;
}
case RPCSVC_EVENT_DISCONNECT:
@@ -395,6 +405,8 @@ server_rpc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event,
if (conn)
server_connection_put (this, conn);
+ list_del (&xprt->list);
+
break;
default:
break;
@@ -449,6 +461,7 @@ init (xlator_t *this)
GF_VALIDATE_OR_GOTO(this->name, conf, out);
INIT_LIST_HEAD (&conf->conns);
+ INIT_LIST_HEAD (&conf->xprt_list);
pthread_mutex_init (&conf->mutex, NULL);
this->private = conf;
diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h
index 62e5ef886cf..b58e8a5fada 100644
--- a/xlators/protocol/server/src/server.h
+++ b/xlators/protocol/server/src/server.h
@@ -99,6 +99,7 @@ struct server_conf {
dict_t *auth_modules;
pthread_mutex_t mutex;
struct list_head conns;
+ struct list_head xprt_list;
};
typedef struct server_conf server_conf_t;