diff --git a/uppsrc/Skylark/App.cpp b/uppsrc/Skylark/App.cpp index 30d28e4dc..4b846fc2b 100644 --- a/uppsrc/Skylark/App.cpp +++ b/uppsrc/Skylark/App.cpp @@ -118,6 +118,10 @@ void SkylarkApp::Signal(int signal) Broadcast(signal); exit(0); break; + case SIGUSR1: + Broadcast(signal); + SigUsr1(); + break; case SIGALRM: if(getpid() != TheApp().main_pid) { // "Timeout - session stoped" @@ -239,6 +243,9 @@ void SkylarkApp::Run() SKYLARKLOG("ExitSkylark"); } +void SkylarkApp::SigUsr1() +{ +} void SkylarkApp::SqlError(Http& http) { diff --git a/uppsrc/Skylark/Skylark.h b/uppsrc/Skylark/Skylark.h index f46c11d4b..10e301a83 100644 --- a/uppsrc/Skylark/Skylark.h +++ b/uppsrc/Skylark/Skylark.h @@ -1,99 +1,101 @@ -#ifndef _Skylark_Skylark_h -#define _Skylark_Skylark_h - -#include - -namespace Upp { - -namespace Ini { -extern IniBool skylark_log; -}; - -String GetThreadName(); - -#define SKYLARKLOG(x) LOG_(Ini::skylark_log, GetThreadName() << ' ' << x) - -class Renderer; -class Http; - -struct SkylarkSessionConfig { - String cookie; - String dir; - int format; - SqlId table, id_column, data_column, lastwrite_column; - int expire; - - SkylarkSessionConfig(); -}; - -struct AuthExc : Exc { - AuthExc(const String& s) : Exc(s) {} -}; - -struct BadRequestExc : Exc {}; - -struct SkylarkConfig { - String root; - VectorMap view_var; - String path; - String static_dir; - SkylarkSessionConfig session; - int threads; - int port; - int prefork; - int timeout; - bool use_caching; -}; - -class SkylarkApp : protected SkylarkConfig { - TcpSocket server; - Mutex accept_mutex; - int main_pid; - Vector child_pid; - bool quit; - - - void ThreadRun(); - void Broadcast(int signal); - void Signal(int signal); - static void SignalHandler(int signal); - void Main(); - - void FinalizeViews(); - - static SkylarkApp *app; - -#ifdef PLATFORM_WIN32 - static BOOL WINAPI CtrlCHandlerRoutine(__in DWORD dwCtrlType); -#endif - - typedef SkylarkApp CLASSNAME; - - friend class Http; - -public: - virtual void SqlError(Http& http); - virtual void InternalError(Http& http); - virtual void NotFound(Http& http); - virtual void Unauthorized(Http& http); - virtual void BadRequest(Http& http); - - virtual void WorkThread(); - - void RunThread(); - - void Run(); - - static SkylarkApp& TheApp(); - static const SkylarkConfig& Config(); - - SkylarkApp(); - virtual ~SkylarkApp(); -}; - -#include "Witz.h" -#include "Http.h" - -}; - -#endif +#ifndef _Skylark_Skylark_h +#define _Skylark_Skylark_h + +#include + +namespace Upp { + +namespace Ini { +extern IniBool skylark_log; +}; + +String GetThreadName(); + +#define SKYLARKLOG(x) LOG_(Ini::skylark_log, GetThreadName() << ' ' << x) + +class Renderer; +class Http; + +struct SkylarkSessionConfig { + String cookie; + String dir; + int format; + SqlId table, id_column, data_column, lastwrite_column; + int expire; + + SkylarkSessionConfig(); +}; + +struct AuthExc : Exc { + AuthExc(const String& s) : Exc(s) {} +}; + +struct BadRequestExc : Exc {}; + +struct SkylarkConfig { + String root; + VectorMap view_var; + String path; + String static_dir; + SkylarkSessionConfig session; + int threads; + int port; + int prefork; + int timeout; + bool use_caching; +}; + +class SkylarkApp : protected SkylarkConfig { + TcpSocket server; + Mutex accept_mutex; + int main_pid; + Vector child_pid; + bool quit; + + + void ThreadRun(); + void Broadcast(int signal); + void Signal(int signal); + static void SignalHandler(int signal); + void Main(); + + void FinalizeViews(); + + static SkylarkApp *app; + +#ifdef PLATFORM_WIN32 + static BOOL WINAPI CtrlCHandlerRoutine(__in DWORD dwCtrlType); +#endif + + typedef SkylarkApp CLASSNAME; + + friend class Http; + +public: + virtual void SigUsr1(); + + virtual void SqlError(Http& http); + virtual void InternalError(Http& http); + virtual void NotFound(Http& http); + virtual void Unauthorized(Http& http); + virtual void BadRequest(Http& http); + + virtual void WorkThread(); + + void RunThread(); + + void Run(); + + static SkylarkApp& TheApp(); + static const SkylarkConfig& Config(); + + SkylarkApp(); + virtual ~SkylarkApp(); +}; + +#include "Witz.h" +#include "Http.h" + +}; + +#endif diff --git a/uppsrc/Skylark/src.tpp/SkylarkApp$en-us.tpp b/uppsrc/Skylark/src.tpp/SkylarkApp$en-us.tpp index dfbd3eda2..de3cb97e0 100644 --- a/uppsrc/Skylark/src.tpp/SkylarkApp$en-us.tpp +++ b/uppsrc/Skylark/src.tpp/SkylarkApp$en-us.tpp @@ -20,12 +20,17 @@ and changing Skylark configuration, which should be only done in SkylarkApp constructor.&] [s0;i448;a25;kKO9;:noref:@(0.0.255)%- &] [ {{10000F(128)G(128)@1 [s0; [* Public Method List]]}}&] +[s3; &] +[s5;:SkylarkApp`:`:SigUsr1`(`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* SigUsr1]()&] +[s2; Invoked when application recieves SIGUSR1 signal. Default implementation +is empty&] [s3;%- &] +[s4;%- &] [s5;:SkylarkApp`:`:SqlError`(Http`&`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* SqlError ]([_^Http^ Http][@(0.0.255) `&]_[*@3 http])&] [s2; Overriding this method can change the response in case that there was SQL error in handler.&] -[s3; &] +[s3;%- &] [s4; &] [s5;:SkylarkApp`:`:InternalError`(Http`&`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* InternalError]([_^Http^ Http][@(0.0.255) `&]_[*@3 http])&]