fixed offload to thread

This commit is contained in:
Roberto De Ioris
2012-10-18 12:32:02 +02:00
parent 8a65125ae5
commit ef80a7bba9
3 changed files with 9 additions and 2 deletions
+4 -2
View File
@@ -1911,7 +1911,10 @@ int uwsgi_real_file_serve(struct wsgi_request *wsgi_req, char *real_filename, si
// Ok, the file must be transferred from uWSGI
if (wsgi_req->socket->can_offload) {
if (!uwsgi_offload_request_do(wsgi_req, real_filename, st->st_size)) goto done;
if (!uwsgi_offload_request_do(wsgi_req, real_filename, st->st_size)) {
wsgi_req->status = -30;
return 0;
}
}
wsgi_req->sendfile_fd = open(real_filename, O_RDONLY);
@@ -1920,7 +1923,6 @@ int uwsgi_real_file_serve(struct wsgi_request *wsgi_req, char *real_filename, si
close(wsgi_req->sendfile_fd);
}
done:
wsgi_req->status = 200;
return 0;
}
+1
View File
@@ -28,6 +28,7 @@ int uwsgi_offload_request_do(struct wsgi_request *wsgi_req, char *filename, size
uor.pos = 0;
uor.len = len;
uor.written = 0;
uor.buf = NULL;
uor.prev = NULL;
uor.next = NULL;
+4
View File
@@ -2221,7 +2221,9 @@ int uwsgi_start(void *v_argv) {
#endif
// users of the --loop option should know what they are doing... really...
#ifndef UWSGI_DEBUG
if (uwsgi.loop) goto unsafe;
#endif
#ifdef UWSGI_UDP
if (!uwsgi.sockets && !ushared->gateways_cnt && !uwsgi.no_server && !uwsgi.udp_socket && !uwsgi.emperor && !uwsgi.command_mode) {
@@ -2246,7 +2248,9 @@ int uwsgi_start(void *v_argv) {
uwsgi.to_hell = 1;
}
#ifndef UWSGI_DEBUG
unsafe:
#endif
#ifdef UWSGI_DEBUG
struct uwsgi_socket *uwsgi_sock = uwsgi.sockets;