comparison OrthancServer/main.cpp @ 2010:4dafe2a0d3ab

Support of SIGHUP signal (restart Orthanc only if the configuration files have changed)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 09 Jun 2016 17:57:47 +0200
parents e2dd40abce72
children bcc575732aef
comparison
equal deleted inserted replaced
2009:e2dd40abce72 2010:4dafe2a0d3ab
649 } 649 }
650 #endif 650 #endif
651 651
652 context.GetLua().Execute("Initialize"); 652 context.GetLua().Execute("Initialize");
653 653
654 ServerBarrierEvent event = Toolbox::ServerBarrier(restApi.LeaveBarrierFlag()); 654 bool restart;
655 bool restart = restApi.IsResetRequestReceived(); 655
656 656 for (;;)
657 if (!restart && 657 {
658 event == ServerBarrierEvent_Reload) 658 ServerBarrierEvent event = Toolbox::ServerBarrier(restApi.LeaveBarrierFlag());
659 { 659 restart = restApi.IsResetRequestReceived();
660 printf("RECEIVED SIGHUP\n"); 660
661 } 661 if (!restart &&
662 662 event == ServerBarrierEvent_Reload)
663 {
664 if (Configuration::HasConfigurationChanged())
665 {
666 LOG(WARNING) << "A SIGHUP signal has been received, resetting Orthanc";
667 restart = true;
668 break;
669 }
670 else
671 {
672 LOG(WARNING) << "A SIGHUP signal has been received, but is ignored as the configuration has not changed";
673 continue;
674 }
675 }
676 else
677 {
678 break;
679 }
680 }
663 681
664 context.GetLua().Execute("Finalize"); 682 context.GetLua().Execute("Finalize");
665 683
666 #if ORTHANC_PLUGINS_ENABLED == 1 684 #if ORTHANC_PLUGINS_ENABLED == 1
667 if (context.HasPlugins()) 685 if (context.HasPlugins())