Subversion Repositories Tewi

Rev

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

Rev 349 Rev 359
Line 1... Line 1...
1
/* $Id: server.c 349 2024-10-15 20:08:08Z nishi $ */
1
/* $Id: server.c 359 2024-10-16 14:34:51Z nishi $ */
2
 
2
 
3
#define SOURCE
3
#define SOURCE
4
 
4
 
5
#include "../config.h"
5
#include "../config.h"
6
 
6
 
Line 45... Line 45...
45
typedef int socklen_t;
45
typedef int socklen_t;
46
 
46
 
47
#include <tcpustd.h>
47
#include <tcpustd.h>
48
#endif
48
#endif
49
 
49
 
50
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__))
50
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__) && !defined(__DOS__))
51
#ifndef NO_GETNAMEINFO
51
#ifndef NO_GETNAMEINFO
52
#include <ws2tcpip.h>
52
#include <ws2tcpip.h>
53
#include <wspiapi.h>
53
#include <wspiapi.h>
54
#endif
54
#endif
55
#ifdef USE_WINSOCK1
55
#ifdef USE_WINSOCK1
Line 68... Line 68...
68
#define IPPROTO_TCP 0
68
#define IPPROTO_TCP 0
69
#define INADDR_ANY 0
69
#define INADDR_ANY 0
70
#define htons(x) x
70
#define htons(x) x
71
#include "strptime.h"
71
#include "strptime.h"
72
typedef int socklen_t;
72
typedef int socklen_t;
-
 
73
#elif defined(__DOS__)
-
 
74
#include <netinet/tcp.h>
-
 
75
#include <netinet/in.h>
-
 
76
#include <arpa/inet.h>
-
 
77
#include <sys/select.h>
-
 
78
 
-
 
79
#include "strptime.h"
73
#else
80
#else
74
#ifdef USE_POLL
81
#ifdef USE_POLL
75
#ifdef __PPU__
82
#ifdef __PPU__
76
#include <net/poll.h>
83
#include <net/poll.h>
77
#else
84
#else
Line 164... Line 171...
164
#endif
171
#endif
165
}
172
}
166
 
173
 
167
int tw_server_init(void) {
174
int tw_server_init(void) {
168
	int i;
175
	int i;
169
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__))
176
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__OS2__) && !defined(__NETWARE__) && !defined(__DOS__))
170
	WSADATA wsa;
177
	WSADATA wsa;
171
#ifdef USE_WINSOCK1
178
#ifdef USE_WINSOCK1
172
	WSAStartup(MAKEWORD(1, 1), &wsa);
179
	WSAStartup(MAKEWORD(1, 1), &wsa);
173
#else
180
#else
174
	WSAStartup(MAKEWORD(2, 0), &wsa);
181
	WSAStartup(MAKEWORD(2, 0), &wsa);
Line 962... Line 969...
962
	SSL_free(s);
969
	SSL_free(s);
963
#endif
970
#endif
964
	close_socket(sock);
971
	close_socket(sock);
965
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
972
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
966
#ifdef __NETWARE__
973
#ifdef __NETWARE__
-
 
974
#elif defined(__DOS__)
967
#else
975
#else
968
	_endthread();
976
	_endthread();
969
#endif
977
#endif
970
#elif defined(__HAIKU__)
978
#elif defined(__HAIKU__)
971
		exit_thread(0);
979
		exit_thread(0);
Line 984... Line 992...
984
struct thread_entry {
992
struct thread_entry {
985
#ifdef __HAIKU__
993
#ifdef __HAIKU__
986
	thread_id thread;
994
	thread_id thread;
987
#elif defined(__NETWARE__)
995
#elif defined(__NETWARE__)
988
	int thread;
996
	int thread;
-
 
997
#elif defined(__DOS__)
989
#else
998
#else
990
	HANDLE handle;
999
	HANDLE handle;
991
#endif
1000
#endif
992
	bool used;
1001
	bool used;
993
};
1002
};
Line 1073... Line 1082...
1073
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
1082
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
1074
#ifdef __OS2__
1083
#ifdef __OS2__
1075
					_beginthread(tw_server_pass, 0, 0, e);
1084
					_beginthread(tw_server_pass, 0, 0, e);
1076
#elif defined(__NETWARE__)
1085
#elif defined(__NETWARE__)
1077
					tw_server_pass(e);
1086
					tw_server_pass(e);
-
 
1087
#elif defined(__DOS__)
-
 
1088
					tw_server_pass(e);
1078
#else
1089
#else
1079
					_beginthread(tw_server_pass, 0, e);
1090
					_beginthread(tw_server_pass, 0, e);
1080
#endif
1091
#endif
1081
#elif defined(_PSP) || defined(__PPU__)
1092
#elif defined(_PSP) || defined(__PPU__)
1082
						tw_server_pass(e);
1093
						tw_server_pass(e);