Commit 5496b5c8 authored by deuce's avatar deuce
Browse files

Hold the outpub_write mutex until the data is send, not just until it is

removed from the ring buffer.  This prevents the session thread from closing
the socket before send() is called with the data.

Fixed issue seen on techdorks.net with the 404.ssjs file (and likely others
where static files were truncated on send).
parent febc7143
......@@ -6108,7 +6108,6 @@ void http_output_thread(void *arg)
pthread_mutex_lock(&session->outbuf_write);
RingBufRead(obuf, (uchar*)bufdata, avail);
pthread_mutex_unlock(&session->outbuf_write);
if(chunked) {
bufdata+=avail;
*(bufdata++)='\r';
......@@ -6118,6 +6117,7 @@ void http_output_thread(void *arg)
if(!failed)
sess_sendbuf(session, buf, len, &failed);
pthread_mutex_unlock(&session->outbuf_write);
}
thread_down();
/* Ensure outbuf isn't currently being drained */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment