X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fnetwork%2Fserver.cpp;h=d4e2049472c94caf42da31f7ac2042ecc0246e8d;hb=5c45baac3643a3c7ade8ab0dbaa97dfa55b5117d;hp=df40b3f11ea23d03bf9ca1cb2bb3cdb36b36d6f5;hpb=34f8bf04e4bdffefeceea59b186386b51c542b9d;p=r2c2.git diff --git a/source/network/server.cpp b/source/network/server.cpp index df40b3f..d4e2049 100644 --- a/source/network/server.cpp +++ b/source/network/server.cpp @@ -1,11 +1,6 @@ -/* $Id$ - -This file is part of R²C² -Copyright © 2009-2011 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - +#include #include +#include #include "libr2c2/driver.h" #include "libr2c2/route.h" #include "libr2c2/train.h" @@ -32,7 +27,8 @@ Server::Server(Layout &l): for(map::const_iterator i=trains.begin(); i!=trains.end(); ++i) train_added(*i->second); - listen_sock.listen(Net::InetAddr(0, 8315), 4); + RefPtr addr = Net::resolve("*", "8315", Net::INET); + listen_sock.listen(*addr, 4); listen_sock.signal_data_available.connect(sigc::mem_fun(this, &Server::incoming_connection)); } @@ -217,7 +213,6 @@ void Server::Connection::handshake_done() void Server::Connection::end_of_file() { - socket->close(); stale = true; } @@ -237,7 +232,7 @@ void Server::Connection::receive(const TrainControlPacket &pkt) Train &train = server.layout.get_train(pkt.address); train.set_control(pkt.control, pkt.value); } - catch(const Exception &e) + catch(const exception &e) { error(e.what()); } @@ -252,7 +247,7 @@ void Server::Connection::receive(const TrainFunctionPacket &pkt) if(((pkt.functions^train.get_functions())>>i)&1) train.set_function(i, (pkt.functions>>i)&1); } - catch(const Exception &e) + catch(const exception &e) { error(e.what()); } @@ -271,7 +266,7 @@ void Server::Connection::receive(const TrainRoutePacket &pkt) train.set_route(&route); } } - catch(const Exception &e) + catch(const exception &e) { error(e.what()); }