From 145445c7138013932ce768d39dc2b4c1331e9858 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Tue, 11 Feb 2014 21:00:32 +0000 Subject: [PATCH] changed: now we use curl to fetch a page from the special thread when winix quits (before we were using BSD's fetch) fixed: we didn't use FCGX_Finish_r() on the request made from the special thread so the thread hangs (now we can use pthread_join correctly from the main thread) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@947 e52654a7-88a9-db11-a3e9-0013d4bc506e --- Makefile | 2 +- Makefile.dep | 2 +- core/app.cpp | 38 ++++++++++++++++++++++---------------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 0d9d242..0c6544f 100755 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ winix.so: $(winix.src.files) @cd ../ezc/src ; $(MAKE) -e @cd ../tito/src ; $(MAKE) -e @cd ../pikotools ; $(MAKE) -e - $(CXX) -shared -rdynamic -Wl,-whole-archive -o winix.so $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) core/*.o db/*.o functions/*.o templates/*.o notify/*.o ../ezc/src/ezc.a ../tito/src/tito.a ../pikotools/utf8/utf8.a ../pikotools/space/space.a ../pikotools/mainparser/mainparser.a ../pikotools/date/date.a $(LDFLAGS) -lfcgi -lpq -lz -lfetch -lpthread -Wl,-no-whole-archive + $(CXX) -shared -rdynamic -Wl,-whole-archive -o winix.so $(CXXFLAGS) $(CXXWINIXINCLUDEFLAGS) core/*.o db/*.o functions/*.o templates/*.o notify/*.o ../ezc/src/ezc.a ../tito/src/tito.a ../pikotools/utf8/utf8.a ../pikotools/space/space.a ../pikotools/mainparser/mainparser.a ../pikotools/date/date.a $(LDFLAGS) -lfcgi -lpq -lz -lfetch -lpthread -lcurl -Wl,-no-whole-archive winix: winix.so $(winix.src.files) diff --git a/Makefile.dep b/Makefile.dep index 1e0abf1..e0f6677 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -1 +1 @@ -winix.src.files = ./plugins/gallery/templates.cpp ./plugins/gallery/gallery.cpp ./plugins/gallery/galleryinfo.h ./plugins/gallery/init.cpp ./plugins/gallery/gallery.h ./plugins/gallery/galleryinfo.cpp ./plugins/ticket/templates.cpp ./plugins/ticket/editticket.h ./plugins/ticket/ticketinfo.cpp ./plugins/ticket/funticket.h ./plugins/ticket/init.cpp ./plugins/ticket/ticketinfo.h ./plugins/ticket/createticket.cpp ./plugins/ticket/showtickets.cpp ./plugins/ticket/tdb.cpp ./plugins/ticket/pluginmsg.h ./plugins/ticket/showtickets.h ./plugins/ticket/createticket.h ./plugins/ticket/sessiondata.cpp ./plugins/ticket/tdb.h ./plugins/ticket/sessiondata.h ./plugins/ticket/ticket.h ./plugins/ticket/editticket.cpp ./plugins/ticket/funticket.cpp ./plugins/thread/templates.cpp ./plugins/thread/createthread.h ./plugins/thread/reply.h ./plugins/thread/showthreads.h ./plugins/thread/templates.h ./plugins/thread/init.cpp ./plugins/thread/tdb.cpp ./plugins/thread/pluginmsg.h ./plugins/thread/thread.h ./plugins/thread/tdb.h ./plugins/thread/funthread.cpp ./plugins/thread/threadinfo.cpp ./plugins/thread/funthread.h ./plugins/thread/threadinfo.h ./plugins/thread/showthreads.cpp ./plugins/thread/reply.cpp ./plugins/thread/createthread.cpp ./plugins/stats/stats.cpp ./plugins/stats/templates.cpp ./plugins/stats/init.cpp ./plugins/stats/stats.h ./plugins/stats/templates.h ./plugins/stats/bot.cpp ./plugins/stats/statssession.h ./plugins/stats/bot.h ./plugins/export/exportthread.h ./plugins/export/edb.h ./plugins/export/exportinfo.h ./plugins/export/init.cpp ./plugins/export/export.h ./plugins/export/exportthread.cpp ./plugins/export/message.h ./plugins/export/edb.cpp ./plugins/export/exportinfo.cpp ./plugins/export/funexport.h ./plugins/export/funexport.cpp ./plugins/menu/cache.h ./plugins/menu/templates.cpp ./plugins/menu/init.cpp ./plugins/menu/cache.cpp ./plugins/group/templates.cpp ./plugins/group/groups.cpp ./plugins/group/init.cpp ./plugins/group/groups.h ./plugins/group/groupinfo.cpp ./plugins/group/groupinfo.h ./main/main.cpp ./functions/subject.h ./functions/reload.cpp ./functions/functionparser.h ./functions/cat.cpp ./functions/login.cpp ./functions/tinymce.cpp ./functions/logout.cpp ./functions/run.h ./functions/uname.h ./functions/functions.h ./functions/privchanger.h ./functions/rm.cpp ./functions/default.cpp ./functions/specialdefault.cpp ./functions/node.cpp ./functions/mv.h ./functions/upload.h ./functions/chmod.cpp ./functions/emacs.h ./functions/subject.cpp ./functions/cp.cpp ./functions/uname.cpp ./functions/last.h ./functions/ckeditor.h ./functions/reload.h ./functions/download.h ./functions/tinymce.h ./functions/login.h ./functions/ln.h ./functions/chown.cpp ./functions/functionbase.cpp ./functions/rm.h ./functions/default.h ./functions/adduser.h ./functions/chmod.h ./functions/vim.h ./functions/last.cpp ./functions/mkdir.cpp ./functions/download.cpp ./functions/cp.h ./functions/ln.cpp ./functions/ls.cpp ./functions/priv.cpp ./functions/stat.h ./functions/template.h ./functions/chown.h ./functions/functionbase.h ./functions/adduser.cpp ./functions/vim.cpp ./functions/who.h ./functions/functionparser.cpp ./functions/run.cpp ./functions/uptime.h ./functions/functions.cpp ./functions/privchanger.cpp ./functions/mkdir.h ./functions/stat.cpp ./functions/template.cpp ./functions/cat.h ./functions/logout.h ./functions/mv.cpp ./functions/ls.h ./functions/upload.cpp ./functions/priv.h ./functions/emacs.cpp ./functions/specialdefault.h ./functions/node.h ./functions/who.cpp ./functions/passwd.h ./functions/sort.h ./functions/passwd.cpp ./functions/mount.cpp ./functions/nicedit.h ./functions/sort.cpp ./functions/mount.h ./functions/nicedit.cpp ./functions/pw.cpp ./functions/pw.h ./functions/meta.cpp ./functions/meta.h ./functions/man.cpp ./functions/env.cpp ./functions/env.h ./functions/man.h ./functions/rmuser.cpp ./functions/rmuser.h ./functions/locale.cpp ./functions/timezone.cpp ./functions/timezone.h ./functions/locale.h ./functions/uptime.cpp ./functions/ipban.h ./functions/ipban.cpp ./functions/ckeditor.cpp ./functions/imgcrop.h ./functions/imgcrop.cpp ./functions/account.h ./functions/account.cpp ./core/dirs.h ./core/config.h ./core/postmultiparser.cpp ./core/sessionmanager.cpp ./core/htmlfilter.h ./core/rebus.cpp ./core/dircontainer.cpp ./core/log.cpp ./core/loadavg.h ./core/user.h ./core/session.cpp ./core/mountparser.h ./core/mounts.cpp ./core/app.h ./core/request.cpp ./core/plugindata.cpp ./core/synchro.h ./core/misc.cpp ./core/cookieparser.h ./core/sessioncontainer.h ./core/item.cpp ./core/error.h ./core/compress.h ./core/dirs.cpp ./core/config.cpp ./core/lastcontainer.cpp ./core/httpsimpleparser.cpp ./core/users.h ./core/postparser.h ./core/pluginmsg.h ./core/acceptbaseparser.h ./core/loadavg.cpp ./core/mountparser.cpp ./core/sessionmanager.h ./core/system.cpp ./core/groups.h ./core/synchro.cpp ./core/rebus.h ./core/acceptencodingparser.h ./core/item.h ./core/version.h ./core/compress.cpp ./core/plugindata.h ./core/request.h ./core/plugin.cpp ./core/sessionparser.cpp ./core/bbcodeparser.h ./core/users.cpp ./core/basethread.cpp ./core/mount.cpp ./core/acceptbaseparser.cpp ./core/httpsimpleparser.h ./core/lastcontainer.h ./core/groups.cpp ./core/requesttypes.h ./core/crypt.h ./core/system.h ./core/bbcodeparser.cpp ./core/run.h ./core/group.h ./core/slog.h ./core/plugin.h ./core/sessionparser.h ./core/textstream.h ./core/mount.h ./core/basethread.h ./core/htmlfilter.cpp ./core/image.h ./core/app.cpp ./core/postmultiparser.h ./core/ugcontainer.h ./core/log.h ./core/dircontainer.h ./core/sessioncontainer.cpp ./core/session.h ./core/mounts.h ./core/threadmanager.cpp ./core/crypt.cpp ./core/slog.cpp ./core/threadmanager.h ./core/run.cpp ./core/image.cpp ./core/logmanipulators.h ./core/job.cpp ./core/job.h ./core/user.cpp ./core/timezone.h ./core/timezone.cpp ./core/timezones.cpp ./core/timezones.h ./core/cur.h ./core/lock.h ./core/lock.cpp ./core/ipbancontainer.h ./core/ipbancontainer.cpp ./core/ipban.h ./core/misc.h ./db/dbitemquery.h ./db/dbbase.cpp ./db/dbconn.cpp ./db/db.cpp ./db/dbbase.h ./db/dbitemcolumns.cpp ./db/dbtextstream.cpp ./db/dbconn.h ./db/db.h ./db/dbitemcolumns.h ./db/dbitemquery.cpp ./db/dbtextstream.h ./notify/notifythread.cpp ./notify/notifypool.cpp ./notify/notifythread.h ./notify/notifypool.h ./notify/templatesnotify.cpp ./notify/notify.cpp ./notify/templatesnotify.h ./notify/notify.h ./templates/locale.cpp ./templates/misc.h ./templates/mount.cpp ./templates/templates.h ./templates/last.cpp ./templates/uptime.cpp ./templates/doc.cpp ./templates/filters.cpp ./templates/localefilter.h ./templates/ls.cpp ./templates/dir.cpp ./templates/rebus.cpp ./templates/priv.cpp ./templates/patterncacher.cpp ./templates/htmltextstream.cpp ./templates/patterns.cpp ./templates/adduser.cpp ./templates/misc.cpp ./templates/indexpatterns.h ./templates/winix.cpp ./templates/item.cpp ./templates/templates.cpp ./templates/locale.h ./templates/localefilter.cpp ./templates/stat.cpp ./templates/template.cpp ./templates/user.cpp ./templates/sys.cpp ./templates/upload.cpp ./templates/patterncacher.h ./templates/indexpatterns.cpp ./templates/htmltextstream.h ./templates/who.cpp ./templates/insert.cpp ./templates/changepatterns.cpp ./templates/login.cpp ./templates/slog.cpp ./templates/patterns.h ./templates/config.cpp ./templates/changepatterns.h ./templates/passwd.cpp ./templates/man.cpp ./templates/miscspace.cpp ./templates/miscspace.h ./templates/env.cpp ./templates/textextstream.h ./templates/textextstream.cpp ./templates/ipban.cpp ../ezc/src/item.cpp ../ezc/src/stringconv.h ../ezc/src/pattern.h ../ezc/src/item.h ../ezc/src/ezc.h ../ezc/src/funinfo.h ../ezc/src/generator.h ../ezc/src/stringconv.cpp ../ezc/src/functions.h ../ezc/src/pattern.cpp ../tito/src/crypto.cpp ../tito/src/misc.h ../tito/src/base64.cpp ../tito/src/crypto.h ../tito/src/aes.cpp ../tito/src/base64.h ../tito/src/misc.cpp ../tito/src/aes.h ../pikotools/mainparser/sample/sample.cpp ../pikotools/mainparser/mainparser.cpp ../pikotools/mainparser/mainparser.h ../pikotools/space/space.h ../pikotools/space/spaceparser.cpp ../pikotools/space/space.cpp ../pikotools/space/spaceparser.h ../pikotools/space/jsontospaceparser.cpp ../pikotools/space/spacetojson.cpp ../pikotools/space/jsontospaceparser.h ../pikotools/space/spacetojson.h ../pikotools/date/date.h ../pikotools/date/date.cpp ../pikotools/membuffer/membuffer.h ../pikotools/utf8/utf8.cpp ../pikotools/utf8/utf8.h ../pikotools/textstream/textstream.h ../pikotools/textstream/types.h ../pikotools/convert/convert.h ../pikotools/convert/inttostr.h \ No newline at end of file +winix.src.files = ./templates/htmltextstream.cpp ./templates/textextstream.h ./templates/adduser.cpp ./templates/ipban.cpp ./templates/misc.cpp ./templates/indexpatterns.h ./templates/item.cpp ./templates/templates.cpp ./templates/winix.cpp ./templates/locale.h ./templates/slog.cpp ./templates/localefilter.cpp ./templates/config.cpp ./templates/patterns.h ./templates/changepatterns.h ./templates/stat.cpp ./templates/template.cpp ./templates/miscspace.h ./templates/sys.cpp ./templates/user.cpp ./templates/textextstream.cpp ./templates/upload.cpp ./templates/env.cpp ./templates/indexpatterns.cpp ./templates/patterncacher.h ./templates/htmltextstream.h ./templates/who.cpp ./templates/locale.cpp ./templates/misc.h ./templates/patterns.cpp ./templates/passwd.cpp ./templates/mount.cpp ./templates/last.cpp ./templates/templates.h ./templates/uptime.cpp ./templates/insert.cpp ./templates/doc.cpp ./templates/changepatterns.cpp ./templates/miscspace.cpp ./templates/filters.cpp ./templates/login.cpp ./templates/localefilter.h ./templates/man.cpp ./templates/dir.cpp ./templates/ls.cpp ./templates/rebus.cpp ./templates/priv.cpp ./templates/patterncacher.cpp ./plugins/stats/stats.cpp ./plugins/stats/templates.cpp ./plugins/stats/init.cpp ./plugins/stats/stats.h ./plugins/stats/templates.h ./plugins/stats/bot.cpp ./plugins/stats/statssession.h ./plugins/stats/bot.h ./plugins/gallery/gallery.cpp ./plugins/gallery/galleryinfo.h ./plugins/gallery/init.cpp ./plugins/gallery/gallery.h ./plugins/gallery/galleryinfo.cpp ./plugins/gallery/templates.cpp ./plugins/export/exportthread.cpp ./plugins/export/message.h ./plugins/export/edb.cpp ./plugins/export/funexport.cpp ./plugins/export/exportinfo.cpp ./plugins/export/exportthread.h ./plugins/export/edb.h ./plugins/export/funexport.h ./plugins/export/exportinfo.h ./plugins/export/init.cpp ./plugins/export/export.h ./plugins/ticket/sessiondata.h ./plugins/ticket/ticket.h ./plugins/ticket/editticket.cpp ./plugins/ticket/funticket.cpp ./plugins/ticket/editticket.h ./plugins/ticket/templates.cpp ./plugins/ticket/ticketinfo.cpp ./plugins/ticket/funticket.h ./plugins/ticket/init.cpp ./plugins/ticket/ticketinfo.h ./plugins/ticket/createticket.cpp ./plugins/ticket/showtickets.cpp ./plugins/ticket/tdb.cpp ./plugins/ticket/pluginmsg.h ./plugins/ticket/createticket.h ./plugins/ticket/showtickets.h ./plugins/ticket/sessiondata.cpp ./plugins/ticket/tdb.h ./plugins/menu/cache.cpp ./plugins/menu/init.cpp ./plugins/menu/cache.h ./plugins/menu/templates.cpp ./plugins/thread/init.cpp ./plugins/thread/templates.h ./plugins/thread/tdb.cpp ./plugins/thread/pluginmsg.h ./plugins/thread/thread.h ./plugins/thread/tdb.h ./plugins/thread/funthread.cpp ./plugins/thread/threadinfo.cpp ./plugins/thread/funthread.h ./plugins/thread/threadinfo.h ./plugins/thread/createthread.cpp ./plugins/thread/reply.cpp ./plugins/thread/showthreads.cpp ./plugins/thread/templates.cpp ./plugins/thread/createthread.h ./plugins/thread/reply.h ./plugins/thread/showthreads.h ./plugins/group/groupinfo.h ./plugins/group/templates.cpp ./plugins/group/groups.cpp ./plugins/group/init.cpp ./plugins/group/groups.h ./plugins/group/groupinfo.cpp ./main/main.cpp ./db/dbtextstream.cpp ./db/dbconn.h ./db/db.h ./db/dbitemcolumns.h ./db/dbitemquery.cpp ./db/dbtextstream.h ./db/dbitemquery.h ./db/dbbase.cpp ./db/dbconn.cpp ./db/db.cpp ./db/dbbase.h ./db/dbitemcolumns.cpp ./core/users.h ./core/threadmanager.h ./core/slog.h ./core/pluginmsg.h ./core/config.h ./core/httpsimpleparser.h ./core/loadavg.cpp ./core/mountparser.cpp ./core/htmlfilter.h ./core/groups.cpp ./core/dircontainer.cpp ./core/timezones.h ./core/postmultiparser.h ./core/image.cpp ./core/requesttypes.h ./core/ugcontainer.h ./core/logmanipulators.h ./core/rebus.h ./core/synchro.cpp ./core/log.h ./core/session.h ./core/misc.cpp ./core/lock.h ./core/item.cpp ./core/cur.h ./core/dirs.cpp ./core/threadmanager.cpp ./core/slog.cpp ./core/httpsimpleparser.cpp ./core/postparser.h ./core/run.h ./core/htmlfilter.cpp ./core/lastcontainer.h ./core/rebus.cpp ./core/loadavg.h ./core/sessionmanager.h ./core/mountparser.h ./core/groups.h ./core/app.h ./core/dircontainer.h ./core/lock.cpp ./core/synchro.h ./core/compress.cpp ./core/plugindata.h ./core/misc.h ./core/crypt.cpp ./core/group.h ./core/run.cpp ./core/sessionparser.h ./core/lastcontainer.cpp ./core/dirs.h ./core/mount.h ./core/acceptbaseparser.cpp ./core/sessionmanager.cpp ./core/job.h ./core/app.cpp ./core/user.h ./core/mounts.cpp ./core/plugindata.cpp ./core/system.h ./core/version.h ./core/sessioncontainer.h ./core/cookieparser.h ./core/bbcodeparser.cpp ./core/request.h ./core/ipban.h ./core/timezone.h ./core/compress.h ./core/sessionparser.cpp ./core/users.cpp ./core/ipbancontainer.h ./core/mount.cpp ./core/plugin.h ./core/config.cpp ./core/textstream.h ./core/crypt.h ./core/basethread.h ./core/job.cpp ./core/acceptbaseparser.h ./core/postmultiparser.cpp ./core/timezones.cpp ./core/user.cpp ./core/log.cpp ./core/session.cpp ./core/system.cpp ./core/sessioncontainer.cpp ./core/image.h ./core/request.cpp ./core/acceptencodingparser.h ./core/error.h ./core/timezone.cpp ./core/mounts.h ./core/ipbancontainer.cpp ./core/plugin.cpp ./core/bbcodeparser.h ./core/basethread.cpp ./core/item.h ./functions/node.h ./functions/account.cpp ./functions/emacs.h ./functions/env.h ./functions/subject.cpp ./functions/who.h ./functions/last.cpp ./functions/uptime.cpp ./functions/imgcrop.h ./functions/reload.cpp ./functions/cp.h ./functions/download.cpp ./functions/functions.cpp ./functions/logout.cpp ./functions/cat.h ./functions/login.h ./functions/rmuser.cpp ./functions/rm.cpp ./functions/priv.cpp ./functions/man.h ./functions/specialdefault.cpp ./functions/sort.cpp ./functions/emacs.cpp ./functions/env.cpp ./functions/timezone.h ./functions/chmod.h ./functions/imgcrop.cpp ./functions/cp.cpp ./functions/subject.h ./functions/uptime.h ./functions/last.h ./functions/login.cpp ./functions/run.h ./functions/ckeditor.h ./functions/template.cpp ./functions/stat.cpp ./functions/download.h ./functions/privchanger.h ./functions/logout.h ./functions/rmuser.h ./functions/ls.h ./functions/chown.h ./functions/adduser.cpp ./functions/ipban.cpp ./functions/chmod.cpp ./functions/specialdefault.h ./functions/timezone.cpp ./functions/pw.h ./functions/vim.cpp ./functions/sort.h ./functions/locale.cpp ./functions/passwd.cpp ./functions/ckeditor.cpp ./functions/run.cpp ./functions/uname.cpp ./functions/functionparser.h ./functions/mount.h ./functions/privchanger.cpp ./functions/ln.cpp ./functions/mkdir.h ./functions/tinymce.h ./functions/chown.cpp ./functions/ls.cpp ./functions/nicedit.cpp ./functions/template.h ./functions/stat.h ./functions/functionbase.h ./functions/node.cpp ./functions/pw.cpp ./functions/mv.h ./functions/upload.h ./functions/default.h ./functions/meta.h ./functions/adduser.h ./functions/who.cpp ./functions/ipban.h ./functions/vim.h ./functions/account.h ./functions/functionparser.cpp ./functions/mount.cpp ./functions/locale.h ./functions/mkdir.cpp ./functions/passwd.h ./functions/cat.cpp ./functions/tinymce.cpp ./functions/uname.h ./functions/man.cpp ./functions/reload.h ./functions/functions.h ./functions/ln.h ./functions/functionbase.cpp ./functions/mv.cpp ./functions/rm.h ./functions/nicedit.h ./functions/default.cpp ./functions/upload.cpp ./functions/priv.h ./functions/meta.cpp ./notify/notifythread.cpp ./notify/notifypool.cpp ./notify/notifythread.h ./notify/notifypool.h ./notify/templatesnotify.cpp ./notify/notify.cpp ./notify/templatesnotify.h ./notify/notify.h ../ezc/src/item.cpp ../ezc/src/stringconv.h ../ezc/src/pattern.h ../ezc/src/item.h ../ezc/src/ezc.h ../ezc/src/funinfo.h ../ezc/src/generator.h ../ezc/src/stringconv.cpp ../ezc/src/functions.h ../ezc/src/pattern.cpp ../tito/src/crypto.cpp ../tito/src/misc.h ../tito/src/base64.cpp ../tito/src/crypto.h ../tito/src/aes.cpp ../tito/src/base64.h ../tito/src/misc.cpp ../tito/src/aes.h ../pikotools/mainparser/sample/sample.cpp ../pikotools/mainparser/mainparser.cpp ../pikotools/mainparser/mainparser.h ../pikotools/space/space.h ../pikotools/space/spaceparser.cpp ../pikotools/space/space.cpp ../pikotools/space/spaceparser.h ../pikotools/space/jsontospaceparser.cpp ../pikotools/space/spacetojson.cpp ../pikotools/space/jsontospaceparser.h ../pikotools/space/spacetojson.h ../pikotools/date/date.h ../pikotools/date/date.cpp ../pikotools/membuffer/membuffer.h ../pikotools/utf8/utf8.cpp ../pikotools/utf8/utf8.h ../pikotools/textstream/textstream.h ../pikotools/textstream/types.h ../pikotools/convert/convert.h ../pikotools/convert/inttostr.h \ No newline at end of file diff --git a/core/app.cpp b/core/app.cpp index df4ab3c..79531d8 100755 --- a/core/app.cpp +++ b/core/app.cpp @@ -2,7 +2,7 @@ * This file is a part of Winix * and is not publicly distributed * - * Copyright (c) 2010-2013, Tomasz Sowa + * Copyright (c) 2010-2014, Tomasz Sowa * All rights reserved. * */ @@ -11,13 +11,11 @@ #include #include #include -#include -#include -#include #include #include #include #include +#include #include "app.h" #include "plugin.h" #include "misc.h" @@ -398,14 +396,21 @@ void App::ClearAfterRequest() + void App::Start() { while( !synchro.was_stop_signal && FCGX_Accept_r(&fcgi_request) == 0 ) { Lock(); - if( !synchro.was_stop_signal ) + if( synchro.was_stop_signal ) + { + FCGX_Finish_r(&fcgi_request); + } + else + { ProcessRequest(); + } Unlock(); } @@ -1633,10 +1638,7 @@ void App::Unlock() void App::WaitForThreads() { - // special thread hangs on fetchStatURL -- I don't know why - // but it doesn't matter, don't use pthread_join on it - //pthread_join(signal_thread, 0); - + pthread_join(signal_thread, 0); system.thread_manager.StopAll(); } @@ -1644,16 +1646,22 @@ void App::WaitForThreads() void App::FetchPageOnExit() { - // !! CHANGE ME use curl instead of BSD's fetch... - // this allows to port to Linux systems - // stupid trick to break FCGX_Accept_r() function // even with FCGX_InitRequest(..., ..., FCGI_FAIL_ACCEPT_ON_INTR) the FCGX_Accept_r // doesn't want to break on a signal // so we request one page from the server for exiting from FCGX_Accept_r - url_stat url; - fetchStatURL(url_to_fetch_on_exit.c_str(), &url, ""); + Lock(); + CURL * curl = curl_easy_init(); + Unlock(); + + if( curl ) + { + curl_easy_setopt(curl, CURLOPT_URL, url_to_fetch_on_exit.c_str()); + curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1); + curl_easy_perform(curl); + curl_easy_cleanup(curl); + } } @@ -1679,8 +1687,6 @@ sigset_t set; PT::WideToUTF8(app->config.base_url, app->url_to_fetch_on_exit, false); app->Unlock(); - // this thread will hang on this method - // but will be terminated when the main thread exits app->FetchPageOnExit(); pthread_exit(0);