Changeset 183 in Main for trunk/Server/server.c
- Timestamp:
- Sep 28, 2024, 1:15:15 AM (7 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Server/server.c
r182 r183 431 431 #elif defined(__HAIKU__) 432 432 int32_t tw_server_pass(void* ptr) { 433 #endif 434 #if defined(__HAIKU__) || defined(__MINGW32__) 433 #elif defined(_PSP) 434 int tw_server_pass(void* ptr) { 435 #endif 436 #if defined(__HAIKU__) || defined(__MINGW32__) || defined(_PSP) 435 437 int sock = ((struct pass_entry*)ptr)->sock; 436 438 bool ssl = ((struct pass_entry*)ptr)->ssl; … … 855 857 #endif 856 858 859 extern int running; 860 857 861 void tw_server_loop(void) { 858 862 int i; … … 873 877 struct timeval tv; 874 878 #endif 875 while( 1) {879 while(running) { 876 880 #ifdef USE_POLL 877 881 int ret = poll(pollfds, sockcount, 1000); … … 915 919 int sock = accept(sockets[i], (struct sockaddr*)&claddr, &clen); 916 920 cm_log("Server", "New connection accepted"); 917 #if defined(__MINGW32__) || defined(__HAIKU__) 921 #if defined(__MINGW32__) || defined(__HAIKU__) || defined(_PSP) 918 922 struct pass_entry* e = malloc(sizeof(*e)); 919 923 e->sock = sock; … … 941 945 } 942 946 } 947 #elif defined(_PSP) 948 tw_server_pass(e); 943 949 #elif defined(__HAIKU__) 944 int j; 945 for(j = 0; j < sizeof(threads) / sizeof(threads[0]); j++) { 946 if(threads[j].used) { 947 thread_info info; 948 bool kill = false; 949 if(get_thread_info(threads[j].thread, &info) == B_OK) { 950 } else { 951 kill = true; 952 } 953 if(kill) { 954 threads[j].used = false; 955 } 950 int j; 951 for(j = 0; j < sizeof(threads) / sizeof(threads[0]); j++) { 952 if(threads[j].used) { 953 thread_info info; 954 bool kill = false; 955 if(get_thread_info(threads[j].thread, &info) == B_OK) { 956 } else { 957 kill = true; 958 } 959 if(kill) { 960 threads[j].used = false; 956 961 } 957 962 } 958 for(j = 0; j < sizeof(threads) / sizeof(threads[0]); j++) {959 if(!threads[j].used) {960 threads[j].thread = spawn_thread(tw_server_pass, "Tewi HTTPd", 60, e);961 threads[j].used = true;962 resume_thread(threads[j].thread);963 break;964 }963 } 964 for(j = 0; j < sizeof(threads) / sizeof(threads[0]); j++) { 965 if(!threads[j].used) { 966 threads[j].thread = spawn_thread(tw_server_pass, "Tewi HTTPd", 60, e); 967 threads[j].used = true; 968 resume_thread(threads[j].thread); 969 break; 965 970 } 971 } 966 972 #else 967 973 pid_t pid = fork();
Note:
See TracChangeset
for help on using the changeset viewer.