Commit eaa8288a73872cb8d8b3d0b3455d79ce2579f438
- Diff rendering mode:
- inline
- side by side
src/net/connection.cpp
(16 / 0)
|   | |||
| 36 | 36 | enet_address_set_host(&enetAddress, address.c_str()); | |
| 37 | 37 | enetAddress.port = port; | |
| 38 | 38 | ||
| 39 | #if ENET_VERSION_MAJOR != 1 | ||
| 40 | #error Unsuported enet version! | ||
| 41 | #elif ENET_VERSION_MINOR < 3 | ||
| 39 | 42 | mLocal = enet_host_create(NULL /* create a client host */, | |
| 40 | 43 | 1 /* allow one outgoing connection */, | |
| 41 | 44 | 0 /* assume any amount of incoming bandwidth */, | |
| 42 | 45 | 0 /* assume any amount of outgoing bandwidth */); | |
| 46 | #else | ||
| 47 | mLocal = enet_host_create(NULL /* create a client host */, | ||
| 48 | 1 /* allow one outgoing connection */, | ||
| 49 | 0 /* unlimited channel count */, | ||
| 50 | 0 /* assume any amount of incoming bandwidth */, | ||
| 51 | 0 /* assume any amount of outgoing bandwidth */); | ||
| 52 | #endif | ||
| 43 | 53 | ||
| 44 | 54 | if (!mLocal) | |
| 45 | 55 | return false; | |
| 46 | 56 | ||
| 47 | 57 | // Initiate the connection, allocating channel 0. | |
| 58 | #if ENET_VERSION_MAJOR != 1 | ||
| 59 | #error Unsuported enet version! | ||
| 60 | #elif ENET_VERSION_MINOR < 3 | ||
| 48 | 61 | mRemote = enet_host_connect(mLocal, &enetAddress, 1); | |
| 62 | #else | ||
| 63 | mRemote = enet_host_connect(mLocal, &enetAddress, 1, 0); | ||
| 64 | #endif | ||
| 49 | 65 | ||
| 50 | 66 | ENetEvent event; | |
| 51 | 67 | if (enet_host_service(mLocal, &event, 10000) <= 0 || |
src/net/connectionhandler.cpp
(11 / 0)
|   | |||
| 40 | 40 | enet_address_set_host(&address, listenHost.c_str()); | |
| 41 | 41 | ||
| 42 | 42 | LOG_INFO("Listening on port " << port << "..."); | |
| 43 | #if ENET_VERSION_MAJOR != 1 | ||
| 44 | #error Unsuported enet version! | ||
| 45 | #elif ENET_VERSION_MINOR < 3 | ||
| 43 | 46 | host = enet_host_create( | |
| 44 | 47 | &address /* the address to bind the server host to */, | |
| 45 | 48 | Configuration::getValue("net_maxClients", 1000) /* allowed connections */, | |
| 46 | 49 | 0 /* assume any amount of incoming bandwidth */, | |
| 47 | 50 | 0 /* assume any amount of outgoing bandwidth */); | |
| 51 | #else | ||
| 52 | host = enet_host_create( | ||
| 53 | &address /* the address to bind the server host to */, | ||
| 54 | Configuration::getValue("net_maxClients", 1000) /* allowed connections */, | ||
| 55 | 0 /* unlimited channel count */, | ||
| 56 | 0 /* assume any amount of incoming bandwidth */, | ||
| 57 | 0 /* assume any amount of outgoing bandwidth */); | ||
| 58 | #endif | ||
| 48 | 59 | ||
| 49 | 60 | return host != 0; | |
| 50 | 61 | } |

