]> git.tdb.fi Git - r2c2.git/commitdiff
Adapt to mspnet API changes
authorMikko Rasa <tdb@tdb.fi>
Thu, 17 Jan 2013 14:13:14 +0000 (16:13 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 17 Jan 2013 14:13:14 +0000 (16:13 +0200)
source/network/server.cpp
source/network/server.h

index c0a69463622d17d5f8b65fb55fd886692994ee36..d4e2049472c94caf42da31f7ac2042ecc0246e8d 100644 (file)
@@ -1,4 +1,6 @@
+#include <msp/core/refptr.h>
 #include <msp/net/inet.h>
+#include <msp/net/resolve.h>
 #include "libr2c2/driver.h"
 #include "libr2c2/route.h"
 #include "libr2c2/train.h"
@@ -25,7 +27,8 @@ Server::Server(Layout &l):
        for(map<unsigned, Train *>::const_iterator i=trains.begin(); i!=trains.end(); ++i)
                train_added(*i->second);
 
-       listen_sock.listen(Net::InetAddr(0, 8315), 4);
+       RefPtr<Net::SockAddr> addr = Net::resolve("*", "8315", Net::INET);
+       listen_sock.listen(*addr, 4);
        listen_sock.signal_data_available.connect(sigc::mem_fun(this, &Server::incoming_connection));
 }
 
@@ -210,7 +213,6 @@ void Server::Connection::handshake_done()
 
 void Server::Connection::end_of_file()
 {
-       socket->close();
        stale = true;
 }
 
index 16022ba9d12664596ac4d19aec2881c8d985ca0f..febd567598e0e71def517c7a9743bfdc77706994 100644 (file)
@@ -4,7 +4,7 @@
 #include <msp/io/eventdispatcher.h>
 #include <msp/net/communicator.h>
 #include <msp/net/streamsocket.h>
-#include <msp/net/streamlistensocket.h>
+#include <msp/net/streamserversocket.h>
 #include "libr2c2/layout.h"
 #include "libr2c2/trainstatus.h"
 #include "packets.h"
@@ -39,7 +39,7 @@ private:
 
        Protocol proto;
        Layout &layout;
-       Msp::Net::StreamListenSocket listen_sock;
+       Msp::Net::StreamServerSocket listen_sock;
        Msp::IO::EventDispatcher *event_disp;
        std::vector<Connection *> connections;