Changeset - r11599:60558ee2245d
[Not reviewed]
master
0 2 0
rubidium - 16 years ago 2009-04-08 01:22:57
rubidium@openttd.org
(svn r15978) -Codechange: support parsing [] enclosed IPv6 addresses.
2 files changed with 12 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/network/core/address.h
Show inline comments
 
@@ -96,7 +96,7 @@ public:
 
		if (StrEmpty(hostname)) hostname = "";
 
		if (*hostname == '[') hostname++;
 
		strecpy(this->hostname, StrEmpty(hostname) ? "" : hostname, lastof(this->hostname));
 
		char *tmp = strrchr(hostname, ']');
 
		char *tmp = strrchr(this->hostname, ']');
 
		if (tmp != NULL) *tmp = '\0';
 

	
 
		memset(&this->address, 0, sizeof(this->address));
src/network/network.cpp
Show inline comments
 
@@ -374,14 +374,25 @@ static void CheckMinActiveClients()
 
 * occupied by connection_string. */
 
void ParseConnectionString(const char **company, const char **port, char *connection_string)
 
{
 
	bool ipv6 = false;
 
	char *p;
 
	for (p = connection_string; *p != '\0'; p++) {
 
		switch (*p) {
 
			case '[':
 
				ipv6 = true;
 
				break;
 

	
 
			case ']':
 
				ipv6 = false;
 
				break;
 

	
 
			case '#':
 
				*company = p + 1;
 
				*p = '\0';
 
				break;
 

	
 
			case ':':
 
				if (ipv6) break;
 
				*port = p + 1;
 
				*p = '\0';
 
				break;
0 comments (0 inline, 0 general)