summaryrefslogtreecommitdiffstats
path: root/src/Net/Listener.cpp
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2008-06-26 16:39:25 +0200
committerMatthias Schiffer <matthias@gamezock.de>2008-06-26 16:39:25 +0200
commitea9fe3ef923000a7bfa4d7afc306669d5442e0fc (patch)
treefc549e40acbee781282478fc9c8e351507e99a9f /src/Net/Listener.cpp
parent91bdac7f768e538a2e25b04347b747b1902e3159 (diff)
downloadmad-ea9fe3ef923000a7bfa4d7afc306669d5442e0fc.tar
mad-ea9fe3ef923000a7bfa4d7afc306669d5442e0fc.zip
ConnectionManager f?r den Kern hinzugef?gt
Diffstat (limited to 'src/Net/Listener.cpp')
-rw-r--r--src/Net/Listener.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Net/Listener.cpp b/src/Net/Listener.cpp
index 3fb2415..8386389 100644
--- a/src/Net/Listener.cpp
+++ b/src/Net/Listener.cpp
@@ -67,13 +67,32 @@ Listener::Listener(const IPAddress &address0) throw(ConnectionException)
}
Listener::~Listener() {
+ for(std::list<ServerConnection*>::iterator con = connections.begin(); con != connections.end(); ++con) {
+ (*con)->disconnect();
+ delete *con;
+ }
+
shutdown(sock, SHUT_RDWR);
close(sock);
gnutls_dh_params_deinit(dh_params);
}
+std::vector<struct pollfd> Listener::getPollfds() const {
+ std::vector<struct pollfd> pollfds;
+
+ struct pollfd fd = {sock, POLLIN, 0};
+ pollfds.push_back(fd);
+
+ for(std::list<ServerConnection*>::const_iterator con = connections.begin(); con != connections.end(); ++con)
+ pollfds.push_back((*con)->getPollfd());
+
+ return pollfds;
+}
+
ServerConnection* Listener::getConnection() {
+ // TODO: Logging
+
int sd;
struct sockaddr_in sa;
socklen_t addrlen = sizeof(sa);