messages_dgm: Drop a segment if we can't ship it for 60 seconds
authorVolker Lendecke <vl@samba.org>
Mon, 12 Sep 2016 12:12:10 +0000 (14:12 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 4 Oct 2016 22:06:22 +0000 (00:06 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/messages_dgm.c

index 5f821685a4a032ce4ad23b06fc22eff19498e93c..89ccce9c7e0b93ae6f57263f0c9a107605e424d7 100644 (file)
@@ -455,6 +455,8 @@ static void messaging_dgm_out_queue_trigger(struct tevent_req *req,
        struct messaging_dgm_out_queue_state *state = tevent_req_data(
                req, struct messaging_dgm_out_queue_state);
 
+       tevent_req_reset_endtime(req);
+
        state->subreq = pthreadpool_tevent_job_send(
                state, state->ev, state->pool,
                messaging_dgm_out_threaded_job, state);
@@ -518,6 +520,7 @@ static int messaging_dgm_out_send_fragment(
 {
        struct tevent_req *req;
        size_t qlen;
+       bool ok;
 
        qlen = tevent_queue_length(out->queue);
        if (qlen == 0) {
@@ -550,6 +553,13 @@ static int messaging_dgm_out_send_fragment(
        }
        tevent_req_set_callback(req, messaging_dgm_out_sent_fragment, out);
 
+       ok = tevent_req_set_endtime(req, ev,
+                                   tevent_timeval_current_ofs(60, 0));
+       if (!ok) {
+               TALLOC_FREE(req);
+               return ENOMEM;
+       }
+
        return 0;
 }