summaryrefslogtreecommitdiffstats
path: root/src/plugins/http_static
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/http_static')
-rw-r--r--src/plugins/http_static/http_static.h2
-rw-r--r--src/plugins/http_static/static_server.c18
2 files changed, 14 insertions, 6 deletions
diff --git a/src/plugins/http_static/http_static.h b/src/plugins/http_static/http_static.h
index f9364801a71..bee79090d2b 100644
--- a/src/plugins/http_static/http_static.h
+++ b/src/plugins/http_static/http_static.h
@@ -47,7 +47,7 @@ typedef struct
/** Data length */
u64 data_len;
/** Current data send offset */
- u32 data_offset;
+ u64 data_offset;
/** Need to free data in detach_cache_entry */
int free_data;
/** File cache pool index */
diff --git a/src/plugins/http_static/static_server.c b/src/plugins/http_static/static_server.c
index 5515a98b446..9d9a68f7d02 100644
--- a/src/plugins/http_static/static_server.c
+++ b/src/plugins/http_static/static_server.c
@@ -87,6 +87,8 @@ start_send_data (hss_session_t *hs, http_status_code_t status)
http_msg_t msg;
session_t *ts;
u8 *headers_buf = 0;
+ u32 n_enq;
+ u64 to_send;
int rv;
ts = session_get (hs->vpp_session_index, hs->thread_index);
@@ -147,9 +149,12 @@ start_send_data (hss_session_t *hs, http_status_code_t status)
if (!msg.data.body_len)
goto done;
- rv = svm_fifo_enqueue (ts->tx_fifo, hs->data_len, hs->data);
+ to_send = hs->data_len;
+ n_enq = clib_min (svm_fifo_size (ts->tx_fifo), to_send);
- if (rv != hs->data_len)
+ rv = svm_fifo_enqueue (ts->tx_fifo, n_enq, hs->data);
+
+ if (rv < to_send)
{
hs->data_offset = (rv > 0) ? rv : 0;
svm_fifo_add_want_deq_ntf (ts->tx_fifo, SVM_FIFO_WANT_DEQ_NOTIF);
@@ -598,7 +603,8 @@ static int
hss_ts_tx_callback (session_t *ts)
{
hss_session_t *hs;
- u32 to_send;
+ u32 n_enq;
+ u64 to_send;
int rv;
hs = hss_session_get (ts->thread_index, ts->opaque);
@@ -606,7 +612,9 @@ hss_ts_tx_callback (session_t *ts)
return 0;
to_send = hs->data_len - hs->data_offset;
- rv = svm_fifo_enqueue (ts->tx_fifo, to_send, hs->data + hs->data_offset);
+ n_enq = clib_min (svm_fifo_size (ts->tx_fifo), to_send);
+
+ rv = svm_fifo_enqueue (ts->tx_fifo, n_enq, hs->data + hs->data_offset);
if (rv <= 0)
{
@@ -993,7 +1001,7 @@ format_hss_session (u8 *s, va_list *args)
hss_session_t *hs = va_arg (*args, hss_session_t *);
int __clib_unused verbose = va_arg (*args, int);
- s = format (s, "\n path %s, data length %u, data_offset %u",
+ s = format (s, "\n path %s, data length %llu, data_offset %llu",
hs->path ? hs->path : (u8 *) "[none]", hs->data_len,
hs->data_offset);
return s;