Subversion Repositories Tewi

Rev

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

Rev 253 Rev 255
Line 1... Line 1...
1
/* $Id: server.c 253 2024-10-04 03:13:36Z nishi $ */
1
/* $Id: server.c 255 2024-10-04 04:08:58Z nishi $ */
2
 
2
 
3
#define SOURCE
3
#define SOURCE
4
 
4
 
5
#include "../config.h"
5
#include "../config.h"
6
 
6
 
Line 31... Line 31...
31
#include <cm_string.h>
31
#include <cm_string.h>
32
#include <cm_log.h>
32
#include <cm_log.h>
33
#include <cm_dir.h>
33
#include <cm_dir.h>
34
 
34
 
35
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
35
#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
36
#ifndef NO_GETADDRINFO
36
#ifndef NO_GETNAMEINFO
37
#include <ws2tcpip.h>
37
#include <ws2tcpip.h>
38
#include <wspiapi.h>
38
#include <wspiapi.h>
39
#endif
39
#endif
40
#ifdef USE_WINSOCK1
40
#ifdef USE_WINSOCK1
41
#include <winsock.h>
41
#include <winsock.h>
Line 61... Line 61...
61
#include <arpa/inet.h>
61
#include <arpa/inet.h>
62
#include <netinet/in.h>
62
#include <netinet/in.h>
63
#ifndef __PPU__
63
#ifndef __PPU__
64
#include <netinet/tcp.h>
64
#include <netinet/tcp.h>
65
#endif
65
#endif
66
#ifndef NO_GETADDRINFO
66
#ifndef NO_GETNAMEINFO
67
#include <netdb.h>
67
#include <netdb.h>
68
#endif
68
#endif
69
#endif
69
#endif
70
 
70
 
71
#if defined(_PSP) || defined(__ps2sdk__)
71
#if defined(_PSP) || defined(__ps2sdk__)
Line 75... Line 75...
75
#ifdef __HAIKU__
75
#ifdef __HAIKU__
76
#include <OS.h>
76
#include <OS.h>
77
#endif
77
#endif
78
 
78
 
79
#ifndef S_ISDIR
79
#ifndef S_ISDIR
80
#define S_ISDIR(x) ((x) & _S_IFDIR)
80
#define S_ISDIR(x) ((x)&_S_IFDIR)
81
#endif
81
#endif
82
 
82
 
83
extern struct tw_config config;
83
extern struct tw_config config;
84
extern char tw_server[];
84
extern char tw_server[];
85
 
85
 
Line 491... Line 491...
491
	char address[513];
491
	char address[513];
492
	int ret;
492
	int ret;
493
	struct tw_http_request req;
493
	struct tw_http_request req;
494
	struct tw_http_response res;
494
	struct tw_http_response res;
495
	struct tw_tool tools;
495
	struct tw_tool tools;
-
 
496
	char* addrstr;
496
#ifndef NO_GETADDRINFO
497
#ifndef NO_GETNAMEINFO
497
	struct sockaddr* sa = (struct sockaddr*)&addr;
498
	struct sockaddr* sa = (struct sockaddr*)&addr;
498
	getnameinfo(sa, sizeof(addr), address, 512, NULL, 0, NI_NUMERICHOST);
499
	getnameinfo(sa, sizeof(addr), address, 512, NULL, 0, NI_NUMERICHOST);
499
#endif
500
#endif
-
 
501
	addrstr = inet_ntoa(addr.sin_addr);
-
 
502
	strcpy(address, addrstr);
500
	address[0] = 0;
503
	address[strlen(addrstr)] = 0;
501
#ifdef FREE_PTR
504
#ifdef FREE_PTR
502
	free(ptr);
505
	free(ptr);
503
#endif
506
#endif
504
 
507
 
505
	res._processed = false;
508
	res._processed = false;
Line 1047... Line 1050...
1047
#endif
1050
#endif
1048
				}
1051
				}
1049
			}
1052
			}
1050
		}
1053
		}
1051
	}
1054
	}
1052
	for(i = 0; i < sockcount; i++){
1055
	for(i = 0; i < sockcount; i++) {
1053
		close_socket(sockets[i]);
1056
		close_socket(sockets[i]);
1054
	}
1057
	}
1055
	cm_force_log("Server is down");
1058
	cm_force_log("Server is down");
1056
}
1059
}