From 874c398ad9e185cca26011317a2f7ecf2623d214 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 15 Jun 2008 20:29:10 +0000 Subject: IPC now provides feedback via the named pipe, right now the data is just the server name git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9912 e03df62e-2008-0410-955e-edbf42e46eb7 --- win/inspircd_namedpipe.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'win') diff --git a/win/inspircd_namedpipe.cpp b/win/inspircd_namedpipe.cpp index 5f0c328df..9a960e4c3 100644 --- a/win/inspircd_namedpipe.cpp +++ b/win/inspircd_namedpipe.cpp @@ -22,15 +22,15 @@ void IPCThread::Run() 1000, // client time-out NULL); // no security attribute - printf("*** After CreateNamedPipe *** \n"); + printf("*** After CreateNamedPipe *** \n"); - if (Pipe == INVALID_HANDLE_VALUE) - { - printf("*** IPC failure creating named pipe: %s\n", dlerror()); - return; - } + if (Pipe == INVALID_HANDLE_VALUE) + { + printf("*** IPC failure creating named pipe: %s\n", dlerror()); + return; + } - printf("*** After check, exit flag=%d *** \n", GetExitFlag()); + printf("*** After check, exit flag=%d *** \n", GetExitFlag()); printf("*** Loop *** \n"); Connected = ConnectNamedPipe(Pipe, NULL) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED); @@ -57,6 +57,18 @@ void IPCThread::Run() continue; } + std::stringstream status; + DWORD Written = 0; + ServerInstance->Threads->Mutex(true); + + status << "name " << ServerInstance->Config->ServerName << std::endl; + status << "END" << std::endl; + + ServerInstance->Threads->Mutex(false); + + /* This is a blocking call and will succeed, so long as the client doesnt disconnect */ + Success = WriteFile(Pipe, status.str().data(), status.str().length(), &Written, NULL); + FlushFileBuffers(Pipe); DisconnectNamedPipe(Pipe); } -- cgit v1.2.3