diff options
author | Adam <Adam@anope.org> | 2011-04-26 19:13:51 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-05-16 04:08:47 -0400 |
commit | e7887c1f013248274574ab8e3167f742ccb3d69b (patch) | |
tree | f9f5959512b7129711f03156320ae0e46cabaec3 /src/socketengines/socketengine_pipe.cpp | |
parent | 076ebafa1b4cc935c466c615b94eaac415af9a67 (diff) |
Unmodularized the socket engine because its causing problems and really is unnecessary
Diffstat (limited to 'src/socketengines/socketengine_pipe.cpp')
-rw-r--r-- | src/socketengines/socketengine_pipe.cpp | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/src/socketengines/socketengine_pipe.cpp b/src/socketengines/socketengine_pipe.cpp deleted file mode 100644 index 9d5b47154..000000000 --- a/src/socketengines/socketengine_pipe.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "services.h" - -class PipeIO : public SocketIO -{ - public: - /** Receive something from the buffer - * @param s The socket - * @param buf The buf to read to - * @param sz How much to read - * @return Number of bytes received - */ - int Recv(Socket *s, char *buf, size_t sz) const - { - static char dummy[512]; - while (read(s->GetFD(), &dummy, 512) == 512); - return 0; - } - - /** Write something to the socket - * @param s The socket - * @param buf What to write - * @return Number of bytes written - */ - int Send(Socket *s, const Anope::string &buf) const - { - static const char dummy = '*'; - Pipe *pipe = debug_cast<Pipe *>(s); - return write(pipe->WritePipe, &dummy, 1); - } -} pipeSocketIO; - -Pipe::Pipe() : BufferedSocket() -{ - int fds[2]; - if (pipe(fds)) - throw CoreException(Anope::string("Could not create pipe: ") + Anope::LastError()); - int flags = fcntl(fds[0], F_GETFL, 0); - fcntl(fds[0], F_SETFL, flags | O_NONBLOCK); - flags = fcntl(fds[1], F_GETFL, 0); - fcntl(fds[1], F_SETFL, flags | O_NONBLOCK); - - this->IO = &pipeSocketIO; - this->Sock = fds[0]; - this->WritePipe = fds[1]; - this->IPv6 = false; - - SocketEngine->AddSocket(this); -} - -bool Pipe::ProcessRead() -{ - this->IO->Recv(this, NULL, 0); - return this->Read(""); -} - -bool Pipe::Read(const Anope::string &) -{ - this->OnNotify(); - return true; -} - -void Pipe::Notify() -{ - this->IO->Send(this, ""); -} - -void Pipe::OnNotify() -{ -} - |