summaryrefslogtreecommitdiffstats
path: root/src/Net
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2008-06-26 01:40:24 +0200
committerMatthias Schiffer <matthias@gamezock.de>2008-06-26 01:40:24 +0200
commitfb949bfd7687696c47449aaea0e6a117d382d41c (patch)
treec3c406cc107857e8f7924298823153d5eaa55fcc /src/Net
parent27fe7a9e94704e7bd5420b0c3b59016943f0a333 (diff)
downloadmad-fb949bfd7687696c47449aaea0e6a117d382d41c.tar
mad-fb949bfd7687696c47449aaea0e6a117d382d41c.zip
Listener: Getrennte Verbindungen verwerfen
Diffstat (limited to 'src/Net')
-rw-r--r--src/Net/Listener.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Net/Listener.cpp b/src/Net/Listener.cpp
index b981b20..3fb2415 100644
--- a/src/Net/Listener.cpp
+++ b/src/Net/Listener.cpp
@@ -84,8 +84,16 @@ ServerConnection* Listener::getConnection() {
addrlen = sizeof(sa);
}
- for(std::list<ServerConnection*>::iterator con = connections.begin(); con != connections.end(); con++) {
+ for(std::list<ServerConnection*>::iterator con = connections.begin(); con != connections.end(); ++con)
(*con)->sendReceive();
+
+ for(std::list<ServerConnection*>::iterator con = connections.begin(); con != connections.end();) {
+ if(!(*con)->isConnected()) {
+ delete *con;
+ connections.erase(con++); // Erase unincremented iterator
+
+ continue;
+ }
if(!(*con)->isConnecting()) {
ServerConnection *connection = *con;
@@ -93,6 +101,8 @@ ServerConnection* Listener::getConnection() {
return connection;
}
+
+ ++con;
}
return 0;