# HG changeset patch # User Sebastien Jodogne # Date 1342777612 -7200 # Node ID 09f1eceaccec31903d43fe36184d22378ce000a4 # Parent e67a4e1996c12ee625ec605a5a05d6c6387f0e62# Parent 27e2bbc112006d57110f6b14b758ff8e9dd1299c merge diff -r e67a4e1996c1 -r 09f1eceaccec Core/HttpServer/MongooseServer.cpp --- a/Core/HttpServer/MongooseServer.cpp Fri Jul 20 11:02:13 2012 +0200 +++ b/Core/HttpServer/MongooseServer.cpp Fri Jul 20 11:46:52 2012 +0200 @@ -339,7 +339,7 @@ } typedef boost::find_iterator FindIterator; - typedef boost::iterator_range Range; + typedef boost::iterator_range Range; //chunkStore.Print(); @@ -353,7 +353,7 @@ { if (last != FindIterator()) { -/* Range part(&last->back(), &it->front()); + Range part(&last->back(), &it->front()); Range content = boost::find_first(part, "\r\n\r\n"); if (content != Range()) { @@ -379,7 +379,7 @@ return chunkStore.Store(completedFile, chunkData, chunkSize, fileName->second, fileSize); } } - }*/ + } } last = it; diff -r e67a4e1996c1 -r 09f1eceaccec Core/Toolbox.cpp --- a/Core/Toolbox.cpp Fri Jul 20 11:02:13 2012 +0200 +++ b/Core/Toolbox.cpp Fri Jul 20 11:46:52 2012 +0200 @@ -32,20 +32,28 @@ #endif #if defined(__linux) +#include #include #endif -#include namespace Palantir { static bool finish; +#if defined(_WIN32) + static BOOL WINAPI ConsoleControlHandler(DWORD dwCtrlType) + { + // http://msdn.microsoft.com/en-us/library/ms683242(v=vs.85).aspx + finish = true; + return true; + } +#else static void SignalHandler(int) { finish = true; } - +#endif void Toolbox::Sleep(uint32_t seconds) { @@ -72,9 +80,10 @@ void Toolbox::ServerBarrier() { +#if defined(_WIN32) + SetConsoleCtrlHandler(ConsoleControlHandler, true); +#else signal(SIGINT, SignalHandler); - -#if !defined(_WIN32) signal(SIGQUIT, SignalHandler); #endif @@ -84,9 +93,10 @@ USleep(100000); } +#if defined(_WIN32) + SetConsoleCtrlHandler(ConsoleControlHandler, false); +#else signal(SIGINT, NULL); - -#if !defined(_WIN32) signal(SIGQUIT, NULL); #endif }