diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-08-04 00:28:28 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-08-04 00:28:28 +0200 |
commit | 042496563e38f7a55306f2c32634880802c79f5b (patch) | |
tree | a8eba57cc5f01ce703a169f22908841e02619911 | |
parent | 3f0b8b1ba23854aa7e5b23ab6f9d9c4768dafe88 (diff) | |
parent | 60f0f47c81eefb91863549d3dc37aa58422e3675 (diff) | |
download | manaserv-042496563e38f7a55306f2c32634880802c79f5b.tar.gz manaserv-042496563e38f7a55306f2c32634880802c79f5b.tar.bz2 manaserv-042496563e38f7a55306f2c32634880802c79f5b.tar.xz manaserv-042496563e38f7a55306f2c32634880802c79f5b.zip |
Merge branch 'master' of gitorious.org:mana/manaserv
-rw-r--r-- | src/net/connection.cpp | 12 | ||||
-rw-r--r-- | src/net/connectionhandler.cpp | 9 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/net/connection.cpp b/src/net/connection.cpp index 8bb37821..ceed6f02 100644 --- a/src/net/connection.cpp +++ b/src/net/connection.cpp @@ -36,16 +36,28 @@ bool Connection::start(const std::string &address, int port) enet_address_set_host(&enetAddress, address.c_str()); enetAddress.port = port; +#ifdef ENET_VERSION_MAJOR mLocal = enet_host_create(NULL /* create a client host */, 1 /* allow one outgoing connection */, + 0 /* unlimited channel count */, 0 /* assume any amount of incoming bandwidth */, 0 /* assume any amount of outgoing bandwidth */); +#else + mLocal = enet_host_create(NULL /* create a client host */, + 1 /* allow one outgoing connection */, + 0 /* assume any amount of incoming bandwidth */, + 0 /* assume any amount of outgoing bandwidth */); +#endif if (!mLocal) return false; // Initiate the connection, allocating channel 0. +#ifdef ENET_VERSION_MAJOR + mRemote = enet_host_connect(mLocal, &enetAddress, 1, 0); +#else mRemote = enet_host_connect(mLocal, &enetAddress, 1); +#endif ENetEvent event; if (enet_host_service(mLocal, &event, 10000) <= 0 || diff --git a/src/net/connectionhandler.cpp b/src/net/connectionhandler.cpp index 61e373ef..986d9dec 100644 --- a/src/net/connectionhandler.cpp +++ b/src/net/connectionhandler.cpp @@ -40,11 +40,20 @@ bool ConnectionHandler::startListen(enet_uint16 port, enet_address_set_host(&address, listenHost.c_str()); LOG_INFO("Listening on port " << port << "..."); +#ifdef ENET_VERSION_MAJOR host = enet_host_create( &address /* the address to bind the server host to */, Configuration::getValue("net_maxClients", 1000) /* allowed connections */, + 0 /* unlimited channel count */, 0 /* assume any amount of incoming bandwidth */, 0 /* assume any amount of outgoing bandwidth */); +#else + host = enet_host_create( + &address /* the address to bind the server host to */, + Configuration::getValue("net_maxClients", 1000) /* allowed connections */, + 0 /* assume any amount of incoming bandwidth */, + 0 /* assume any amount of outgoing bandwidth */); +#endif return host != 0; } |