From ab52473a09d10e9695a95dddceb9a467572ab694 Mon Sep 17 00:00:00 2001 From: Pixel Date: Sun, 13 Nov 2011 15:55:53 -0700 Subject: Adding an opaque pointer to the generic Socket listener. --- includes/Socket.h | 5 +++-- tests/test-Sockets.cc | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/includes/Socket.h b/includes/Socket.h index 3b29f49..c31bdd8 100644 --- a/includes/Socket.h +++ b/includes/Socket.h @@ -57,7 +57,7 @@ class Socket : public Handle { template class Listener : public Task { public: - Listener(int port, const char * local = NULL) : m_stop(false) { + Listener(int port, const char * local = NULL, void * opaque = NULL) : m_stop(false), m_opaque(opaque) { bool r = m_listener.setLocal(local, port); Assert(r); r = m_listener.listen(); @@ -79,7 +79,7 @@ class Listener : public Task { yield(); continue; } - new Worker(io); + new Worker(io, m_opaque); } } void stop() { @@ -93,6 +93,7 @@ class Listener : public Task { Events::Async m_evt; volatile bool m_stop; String m_name; + void * m_opaque; }; }; diff --git a/tests/test-Sockets.cc b/tests/test-Sockets.cc index fd6eaa0..0afedb1 100644 --- a/tests/test-Sockets.cc +++ b/tests/test-Sockets.cc @@ -7,14 +7,14 @@ using namespace Balau; class Worker : public Task { public: - Worker(IO io); + Worker(IO io, void *); virtual const char * getName(); virtual void Do(); IO m_io; String m_name; }; -Worker::Worker(IO io) : m_io(io) { +Worker::Worker(IO io, void *) : m_io(io) { m_name = m_io->getName(); Printer::log(M_STATUS, "Got connection: %s", m_name.to_charp()); } -- cgit v1.2.3