mirror of
https://github.com/glest/glest-source.git
synced 2025-08-12 11:24:00 +02:00
- move linux network interface names into ini file for easier management in the future
This commit is contained in:
@@ -66,6 +66,7 @@ MaxLights=3
|
|||||||
Masterserver=http://master.megaglest.org/
|
Masterserver=http://master.megaglest.org/
|
||||||
NetPlayerName=newbie
|
NetPlayerName=newbie
|
||||||
NetworkConsistencyChecks=true
|
NetworkConsistencyChecks=true
|
||||||
|
NetworkInterfaces=lo,eth,wlan,vlan,vboxnet,br-lan,br-gest,enp0s,enp1s,enp2s,enp3s,enp4s,enp5s,enp6s,enp7s,enp8s,enp9s
|
||||||
PhotoMode=false
|
PhotoMode=false
|
||||||
PortList=61357,61367,61377,61387,61397
|
PortList=61357,61367,61377,61387,61397
|
||||||
PortServer=61357
|
PortServer=61357
|
||||||
|
@@ -4615,6 +4615,14 @@ int glestMain(int argc, char** argv) {
|
|||||||
removeFile(binaryNameOld);
|
removeFile(binaryNameOld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string netInterfaces = config.getString("NetworkInterfaces","");
|
||||||
|
if(netInterfaces != "") {
|
||||||
|
//printf("Using network interfaces: %s\n",netInterfaces.c_str());
|
||||||
|
std::vector<std::string> intfList;
|
||||||
|
Tokenize(netInterfaces,intfList,",");
|
||||||
|
Socket::setIntfTypes(intfList);
|
||||||
|
}
|
||||||
|
|
||||||
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_USE_PORTS]) == true) {
|
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_USE_PORTS]) == true) {
|
||||||
int foundParamIndIndex = -1;
|
int foundParamIndIndex = -1;
|
||||||
hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_USE_PORTS]) + string("="),&foundParamIndIndex);
|
hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_USE_PORTS]) + string("="),&foundParamIndIndex);
|
||||||
|
@@ -153,6 +153,7 @@ protected:
|
|||||||
time_t lastSocketError;
|
time_t lastSocketError;
|
||||||
|
|
||||||
static string host_name;
|
static string host_name;
|
||||||
|
static std::vector<string> intfTypes;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Socket(PLATFORM_SOCKET sock);
|
Socket(PLATFORM_SOCKET sock);
|
||||||
@@ -163,6 +164,7 @@ public:
|
|||||||
static const char * getLastSocketErrorText(int *errNumber=NULL);
|
static const char * getLastSocketErrorText(int *errNumber=NULL);
|
||||||
static string getLastSocketErrorFormattedText(int *errNumber=NULL);
|
static string getLastSocketErrorFormattedText(int *errNumber=NULL);
|
||||||
|
|
||||||
|
static void setIntfTypes(std::vector<string> intfTypes) { Socket::intfTypes = intfTypes; }
|
||||||
static bool disableNagle;
|
static bool disableNagle;
|
||||||
static int DEFAULT_SOCKET_SENDBUF_SIZE;
|
static int DEFAULT_SOCKET_SENDBUF_SIZE;
|
||||||
static int DEFAULT_SOCKET_RECVBUF_SIZE;
|
static int DEFAULT_SOCKET_RECVBUF_SIZE;
|
||||||
|
@@ -69,6 +69,7 @@ bool Socket::disableNagle = false;
|
|||||||
int Socket::DEFAULT_SOCKET_SENDBUF_SIZE = -1;
|
int Socket::DEFAULT_SOCKET_SENDBUF_SIZE = -1;
|
||||||
int Socket::DEFAULT_SOCKET_RECVBUF_SIZE = -1;
|
int Socket::DEFAULT_SOCKET_RECVBUF_SIZE = -1;
|
||||||
string Socket::host_name = "";
|
string Socket::host_name = "";
|
||||||
|
std::vector<string> Socket::intfTypes;
|
||||||
|
|
||||||
int Socket::broadcast_portno = 61357;
|
int Socket::broadcast_portno = 61357;
|
||||||
int ServerSocket::ftpServerPort = 61358;
|
int ServerSocket::ftpServerPort = 61358;
|
||||||
@@ -701,27 +702,29 @@ std::vector<std::string> Socket::getLocalIPAddressList() {
|
|||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
|
||||||
// Now check all linux network devices
|
// Now check all linux network devices
|
||||||
std::vector<string> intfTypes;
|
//std::vector<string> intfTypes;
|
||||||
intfTypes.push_back("lo");
|
if(Socket::intfTypes.empty()) {
|
||||||
intfTypes.push_back("eth");
|
Socket::intfTypes.push_back("lo");
|
||||||
intfTypes.push_back("wlan");
|
Socket::intfTypes.push_back("eth");
|
||||||
intfTypes.push_back("vlan");
|
Socket::intfTypes.push_back("wlan");
|
||||||
intfTypes.push_back("vboxnet");
|
Socket::intfTypes.push_back("vlan");
|
||||||
intfTypes.push_back("br-lan");
|
Socket::intfTypes.push_back("vboxnet");
|
||||||
intfTypes.push_back("br-gest");
|
Socket::intfTypes.push_back("br-lan");
|
||||||
intfTypes.push_back("enp0s");
|
Socket::intfTypes.push_back("br-gest");
|
||||||
intfTypes.push_back("enp1s");
|
Socket::intfTypes.push_back("enp0s");
|
||||||
intfTypes.push_back("enp2s");
|
Socket::intfTypes.push_back("enp1s");
|
||||||
intfTypes.push_back("enp3s");
|
Socket::intfTypes.push_back("enp2s");
|
||||||
intfTypes.push_back("enp4s");
|
Socket::intfTypes.push_back("enp3s");
|
||||||
intfTypes.push_back("enp5s");
|
Socket::intfTypes.push_back("enp4s");
|
||||||
intfTypes.push_back("enp6s");
|
Socket::intfTypes.push_back("enp5s");
|
||||||
intfTypes.push_back("enp7s");
|
Socket::intfTypes.push_back("enp6s");
|
||||||
intfTypes.push_back("enp8s");
|
Socket::intfTypes.push_back("enp7s");
|
||||||
intfTypes.push_back("enp9s");
|
Socket::intfTypes.push_back("enp8s");
|
||||||
|
Socket::intfTypes.push_back("enp9s");
|
||||||
|
}
|
||||||
|
|
||||||
for(int intfIdx = 0; intfIdx < (int)intfTypes.size(); intfIdx++) {
|
for(unsigned int intfIdx = 0; intfIdx < Socket::intfTypes.size(); intfIdx++) {
|
||||||
string intfName = intfTypes[intfIdx];
|
string intfName = Socket::intfTypes[intfIdx];
|
||||||
for(int idx = 0; idx < 10; ++idx) {
|
for(int idx = 0; idx < 10; ++idx) {
|
||||||
PLATFORM_SOCKET fd = socket(AF_INET, SOCK_DGRAM, 0);
|
PLATFORM_SOCKET fd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
//PLATFORM_SOCKET fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
//PLATFORM_SOCKET fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
|
Reference in New Issue
Block a user