summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client/src/saved-frames.c
diff options
context:
space:
mode:
authorKrishna Srinivas <krishna@zresearch.com>2009-02-24 06:52:55 -0800
committerAnand V. Avati <avati@amp.gluster.com>2009-02-25 16:48:28 +0530
commit8479df9809107f20df31afb332b8fb6a1931b861 (patch)
treeb7fc430e6ec3fec6a4e394d3a5b148ccfffe315a /xlators/protocol/client/src/saved-frames.c
parentab7fe2987fb4e2c2bd3158682fbb8c1977a049de (diff)
per frame time out - i.e individual frames are unwound instead of the transport point itself being disconnected. timeout is configured using "transport-timeout".
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators/protocol/client/src/saved-frames.c')
-rw-r--r--xlators/protocol/client/src/saved-frames.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/xlators/protocol/client/src/saved-frames.c b/xlators/protocol/client/src/saved-frames.c
index 0d1366d82..6f5b32aed 100644
--- a/xlators/protocol/client/src/saved-frames.c
+++ b/xlators/protocol/client/src/saved-frames.c
@@ -87,9 +87,9 @@ saved_frames_put (struct saved_frames *frames, call_frame_t *frame,
saved_frame->type = type;
saved_frame->callid = callid;
-// gettimeofday (&saved_frame->saved_at, NULL);
+ gettimeofday (&saved_frame->saved_at, NULL);
- list_add (&saved_frame->list, &head_frame->list);
+ list_add_tail (&saved_frame->list, &head_frame->list);
frames->count++;
return 0;
@@ -124,6 +124,26 @@ saved_frames_get (struct saved_frames *frames, int32_t op,
return frame;
}
+struct saved_frame *
+saved_frames_get_timedout (struct saved_frames *frames, int8_t type,
+ uint32_t timeout, struct timeval *current)
+{
+ struct saved_frame *bailout_frame = NULL, *tmp = NULL;
+ struct saved_frame *head_frame = NULL;
+
+ head_frame = get_head_frame_for_type (frames, type);
+
+ if (!list_empty(&head_frame->list)) {
+ tmp = list_entry (head_frame->list.next, typeof (*tmp), list);
+ if ((tmp->saved_at.tv_sec + timeout) < current->tv_sec) {
+ bailout_frame = tmp;
+ list_del_init (&bailout_frame->list);
+ frames->count--;
+ }
+ }
+
+ return bailout_frame;
+}
void
saved_frames_unwind (xlator_t *this, struct saved_frames *saved_frames,