Subversion Repositories Tewi

Rev

Rev 213 | Rev 215 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 213 Rev 214
Line 1... Line 1...
1
/* $Id: server.c 213 2024-10-02 17:45:40Z nishi $ */
1
/* $Id: server.c 214 2024-10-02 17:49:31Z nishi $ */
2
 
2
 
3
#define SOURCE
3
#define SOURCE
4
 
4
 
5
#include "../config.h"
5
#include "../config.h"
6
 
6
 
Line 164... Line 164...
164
#endif
164
#endif
165
		memset(&addresses[i], 0, sizeof(addresses[i]));
165
		memset(&addresses[i], 0, sizeof(addresses[i]));
166
#ifdef NO_IPV6
166
#ifdef NO_IPV6
167
		addresses[i].sin_family = AF_INET;
167
		addresses[i].sin_family = AF_INET;
168
		addresses[i].sin_addr.s_addr = INADDR_ANY;
168
		addresses[i].sin_addr.s_addr = INADDR_ANY;
169
		addresses[i].sin_port = htons(config.ports[i]);
169
		addresses[i].sin_port = htons(config.ports[i] & 0xffff);
170
#else
170
#else
171
		addresses[i].sin6_family = AF_INET6;
171
		addresses[i].sin6_family = AF_INET6;
172
		addresses[i].sin6_addr = in6addr_any;
172
		addresses[i].sin6_addr = in6addr_any;
173
		addresses[i].sin6_port = htons(config.ports[i]);
173
		addresses[i].sin6_port = htons(config.ports[i] & 0xffff);
174
#endif
174
#endif
175
		if(bind(sock, (struct sockaddr*)&addresses[i], sizeof(addresses[i])) < 0) {
175
		if(bind(sock, (struct sockaddr*)&addresses[i], sizeof(addresses[i])) < 0) {
176
			close_socket(sock);
176
			close_socket(sock);
177
			cm_log("Server", "Bind failure");
177
			cm_log("Server", "Bind failure");
178
			return 1;
178
			return 1;
Line 887... Line 887...
887
#if defined(__MINGW32__) || defined(_MSC_VER)
887
#if defined(__MINGW32__) || defined(_MSC_VER)
888
	_endthread(0);
888
	_endthread(0);
889
#elif defined(__HAIKU__)
889
#elif defined(__HAIKU__)
890
		exit_thread(0);
890
		exit_thread(0);
891
#endif
891
#endif
892
	;
892
	return 0;
893
}
893
}
894
 
894
 
895
#ifdef SERVICE
895
#ifdef SERVICE
896
extern SERVICE_STATUS status;
896
extern SERVICE_STATUS status;
897
extern SERVICE_STATUS_HANDLE status_handle;
897
extern SERVICE_STATUS_HANDLE status_handle;