summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/protocol/server')
-rw-r--r--xlators/protocol/server/src/server-helpers.c26
-rw-r--r--xlators/protocol/server/src/server.c4
-rw-r--r--xlators/protocol/server/src/server.h2
3 files changed, 14 insertions, 18 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index 600d73cce81..45f14dcb36e 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -552,7 +552,6 @@ out:
int
server_connection_cleanup (xlator_t *this, server_connection_t *conn)
{
- char do_cleanup = 0;
struct _lock_table *ltable = NULL;
fdentry_t *fdentries = NULL;
uint32_t fd_count = 0;
@@ -563,24 +562,20 @@ server_connection_cleanup (xlator_t *this, server_connection_t *conn)
pthread_mutex_lock (&conn->lock);
{
- conn->active_transports--;
- if (conn->active_transports == 0) {
- if (conn->ltable) {
- ltable = conn->ltable;
- conn->ltable = gf_lock_table_new ();
- }
-
- if (conn->fdtable) {
- fdentries = gf_fd_fdtable_get_all_fds (conn->fdtable,
- &fd_count);
- }
- do_cleanup = 1;
+ if (conn->ltable) {
+ ltable = conn->ltable;
+ conn->ltable = gf_lock_table_new ();
}
+
+ if (conn->fdtable)
+ fdentries = gf_fd_fdtable_get_all_fds (conn->fdtable,
+ &fd_count);
}
pthread_mutex_unlock (&conn->lock);
- if (do_cleanup && conn->bound_xl)
- ret = do_connection_cleanup (this, conn, ltable, fdentries, fd_count);
+ if (conn->bound_xl)
+ ret = do_connection_cleanup (this, conn, ltable,
+ fdentries, fd_count);
out:
return ret;
@@ -814,7 +809,6 @@ server_connection_get (xlator_t *this, const char *id)
list_add (&conn->list, &conf->conns);
conn->ref++;
- conn->active_transports++;
}
unlock:
pthread_mutex_unlock (&conf->mutex);
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index e9f2818200f..d767199d0a7 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -98,12 +98,14 @@ server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg,
struct iovec rsp = {0,};
server_state_t *state = NULL;
char new_iobref = 0;
+ server_connection_t *conn = NULL;
GF_VALIDATE_OR_GOTO ("server", req, ret);
if (frame) {
state = CALL_STATE (frame);
frame->local = NULL;
+ conn = SERVER_CONNECTION(frame);
}
if (!iobref) {
@@ -138,6 +140,8 @@ server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg,
iobuf_unref (iob);
if (ret == -1) {
gf_log_callingfn ("", GF_LOG_ERROR, "Reply submission failed");
+ if (frame && conn)
+ server_connection_cleanup (frame->this, conn);
goto ret;
}
diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h
index 17de0e8d50d..c8fd5f2717c 100644
--- a/xlators/protocol/server/src/server.h
+++ b/xlators/protocol/server/src/server.h
@@ -57,9 +57,7 @@ struct _server_connection {
struct list_head list;
char *id;
int ref;
- int active_transports;
pthread_mutex_t lock;
- char disconnected;
fdtable_t *fdtable;
struct _lock_table *ltable;
xlator_t *bound_xl;