summaryrefslogtreecommitdiff
path: root/src/socketengines/socketengine_win32.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-04-26 19:13:51 -0400
committerAdam <Adam@anope.org>2011-05-16 04:08:47 -0400
commite7887c1f013248274574ab8e3167f742ccb3d69b (patch)
treef9f5959512b7129711f03156320ae0e46cabaec3 /src/socketengines/socketengine_win32.cpp
parent076ebafa1b4cc935c466c615b94eaac415af9a67 (diff)
Unmodularized the socket engine because its causing problems and really is unnecessary
Diffstat (limited to 'src/socketengines/socketengine_win32.cpp')
-rw-r--r--src/socketengines/socketengine_win32.cpp92
1 files changed, 0 insertions, 92 deletions
diff --git a/src/socketengines/socketengine_win32.cpp b/src/socketengines/socketengine_win32.cpp
deleted file mode 100644
index 78d4bf92d..000000000
--- a/src/socketengines/socketengine_win32.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-#include "services.h"
-
-static ClientSocket *newsocket = NULL;
-
-class LSocket : public ListenSocket
-{
- public:
- LSocket(const Anope::string &host, int port) : ListenSocket(host, port, false) { }
-
- ClientSocket *OnAccept(int fd, const sockaddrs &addr)
- {
- newsocket = new ClientSocket(this, fd, addr);
- return newsocket;
- }
-};
-
-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];
- return recv(s->GetFD(), dummy, 512, 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 send(pipe->WritePipe, &dummy, 1, 0);
- }
-} pipeSocketIO;
-
-Pipe::Pipe() : BufferedSocket()
-{
- LSocket lfs("127.0.0.1", 0);
-
- int cfd = socket(AF_INET, SOCK_STREAM, 0);
- if (cfd == -1)
- throw CoreException("Error accepting new socket for Pipe");
-
- sockaddr_in addr;
- socklen_t sz = sizeof(addr);
- getsockname(lfs.GetFD(), reinterpret_cast<sockaddr *>(&addr), &sz);
-
- if (connect(cfd, reinterpret_cast<sockaddr *>(&addr), sz))
- throw CoreException("Error accepting new socket for Pipe");
- lfs.ProcessRead();
- if (!newsocket)
- throw CoreException("Error accepting new socket for Pipe");
-
- this->IO = &pipeSocketIO;
- this->Sock = cfd;
- this->WritePipe = newsocket->GetFD();
- this->IPv6 = false;
-
- SocketEngine->AddSocket(this);
- newsocket = NULL;
-}
-
-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()
-{
-}
-