Return TcpListener pointers rather than objects
It is easier to control object life time and avoid magical socket
duplication by having a single TcpListener object to pass around.
We have to be more careful about deleting the object though.
diff --git a/common/network/TcpSocket.h b/common/network/TcpSocket.h
index 979cd4b..02f04c9 100644
--- a/common/network/TcpSocket.h
+++ b/common/network/TcpSocket.h
@@ -76,8 +76,6 @@
public:
TcpListener(const struct sockaddr *listenaddr, socklen_t listenaddrlen);
TcpListener(int sock);
- TcpListener(const TcpListener& other);
- TcpListener& operator= (const TcpListener& other);
virtual ~TcpListener();
virtual void shutdown();
@@ -87,11 +85,13 @@
int getMyPort();
};
- void createLocalTcpListeners(std::list<TcpListener> *listeners,
+ void createLocalTcpListeners(std::list<TcpListener*> *listeners,
int port);
- void createTcpListeners(std::list<TcpListener> *listeners,
+ void createTcpListeners(std::list<TcpListener*> *listeners,
const char *addr,
int port);
+ void createTcpListeners(std::list<TcpListener*> *listeners,
+ const struct addrinfo *ai);
typedef struct vnc_sockaddr {
union {