MCPcopy Create free account
hub / github.com/apache/httpd / dialup_send_pulse

Function dialup_send_pulse

modules/test/mod_dialup.c:46–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44} dialup_baton_t;
45
46static int
47dialup_send_pulse(dialup_baton_t *db)
48{
49 int status;
50 apr_off_t len = 0;
51 apr_size_t bytes_sent = 0;
52
53 while (!APR_BRIGADE_EMPTY(db->bb) && bytes_sent < db->bytes_per_second) {
54 apr_bucket *e;
55
56 if (db->r->connection->aborted) {
57 return HTTP_INTERNAL_SERVER_ERROR;
58 }
59
60 status = apr_brigade_partition(db->bb, db->bytes_per_second, &e);
61
62 if (status != APR_SUCCESS && status != APR_INCOMPLETE) {
63 /* XXXXXX: Log me. */
64 return HTTP_INTERNAL_SERVER_ERROR;
65 }
66
67 if (e != APR_BRIGADE_SENTINEL(db->bb)) {
68 apr_bucket *f;
69 apr_bucket *b = APR_BUCKET_PREV(e);
70 f = APR_RING_FIRST(&db->bb->list);
71 APR_RING_UNSPLICE(f, b, link);
72 APR_RING_SPLICE_HEAD(&db->tmpbb->list, f, b, apr_bucket, link);
73 }
74 else {
75 APR_BRIGADE_CONCAT(db->tmpbb, db->bb);
76 }
77
78 e = apr_bucket_flush_create(db->r->connection->bucket_alloc);
79
80 APR_BRIGADE_INSERT_TAIL(db->tmpbb, e);
81
82 apr_brigade_length(db->tmpbb, 1, &len);
83 bytes_sent += len;
84 status = ap_pass_brigade(db->r->output_filters, db->tmpbb);
85
86 apr_brigade_cleanup(db->tmpbb);
87
88 if (status != APR_SUCCESS) {
89 ap_log_rerror(APLOG_MARK, APLOG_ERR, status, db->r, APLOGNO(01867)
90 "dialup: pulse: ap_pass_brigade failed:");
91 return AP_FILTER_ERROR;
92 }
93 }
94
95 if (APR_BRIGADE_EMPTY(db->bb)) {
96 return DONE;
97 }
98 else {
99 return SUSPENDED;
100 }
101}
102
103static void

Callers 2

dialup_callbackFunction · 0.85
dialup_handlerFunction · 0.85

Calls 1

ap_pass_brigadeFunction · 0.85

Tested by

no test coverage detected