X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=win%2Finspircd_namedpipe.cpp;h=632c2cca0084ee836f79e7ea2ae62bd3d2a65cfe;hb=152bf4946c3cdee3e8b66cb2babbf3182840d054;hp=06649d103a6a453c4b08c3889791b85090de3d5f;hpb=7721a4de678967c527c4887e036f7a93722296ed;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/win/inspircd_namedpipe.cpp b/win/inspircd_namedpipe.cpp index 06649d103..632c2cca0 100644 --- a/win/inspircd_namedpipe.cpp +++ b/win/inspircd_namedpipe.cpp @@ -1,3 +1,22 @@ +/* + * InspIRCd -- Internet Relay Chat Daemon + * + * Copyright (C) 2008 Craig Edwards + * + * This file is part of InspIRCd. InspIRCd is free software: you can + * redistribute it and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + #include "inspircd.h" #include "threadengine.h" #include "inspircd_namedpipe.h" @@ -6,7 +25,7 @@ #include -IPCThread::IPCThread(InspIRCd* Instance) : Thread(), ServerInstance(Instance) +IPCThread::IPCThread() { if (!initwmi()) ServerInstance->Logs->Log("IPC", DEBUG, "Could not initialise WMI. CPU percantage reports will not be available."); @@ -25,18 +44,18 @@ void IPCThread::Run() { Pipe = CreateNamedPipe (Pipename, PIPE_ACCESS_DUPLEX, // read/write access - PIPE_TYPE_MESSAGE | // message type pipe - PIPE_READMODE_MESSAGE | // message-read mode - PIPE_WAIT, // blocking mode - PIPE_UNLIMITED_INSTANCES, // max. instances - MAXBUF, // output buffer size - MAXBUF, // input buffer size - 1000, // client time-out - NULL); // no security attribute + PIPE_TYPE_MESSAGE | // message type pipe + PIPE_READMODE_MESSAGE | // message-read mode + PIPE_WAIT, // blocking mode + PIPE_UNLIMITED_INSTANCES, // max. instances + MAXBUF, // output buffer size + MAXBUF, // input buffer size + 1000, // client time-out + NULL); // no security attribute if (Pipe == INVALID_HANDLE_VALUE) { - SleepEx(500, true); + SleepEx(10, true); continue; } @@ -127,11 +146,11 @@ void IPCThread::SetResult(int newresult) } -IPC::IPC(InspIRCd* Srv) : ServerInstance(Srv) +IPC::IPC() { /* The IPC pipe is threaded */ - thread = new IPCThread(Srv); - Srv->Threads->Create(thread); + thread = new IPCThread(); + ServerInstance->Threads->Start(thread); } void IPC::Check() @@ -161,6 +180,12 @@ void IPC::Check() thread->ClearStatus(); ServerInstance->Restart("Restarting due to command from GUI"); break; + case '4': + /* Toggle debug */ + thread->SetResult(0); + thread->ClearStatus(); + ServerInstance->Config->cmdline.forcedebug = !ServerInstance->Config->cmdline.forcedebug; + break; } } @@ -168,4 +193,4 @@ IPC::~IPC() { thread->SetExitFlag(); delete thread; -} \ No newline at end of file +}