--- Server/server.c 2024/10/27 23:55:30 1.7 +++ Server/server.c 2024/11/03 06:16:48 1.10 @@ -1,4 +1,4 @@ -/* $Id: server.c,v 1.7 2024/10/27 23:55:30 nishi Exp $ */ +/* $Id: server.c,v 1.10 2024/11/03 06:16:48 nishi Exp $ */ #define SOURCE @@ -344,10 +344,11 @@ void _tw_process_page(SSL* ssl, int sock while(1) { if(f != NULL) { char buffer[512]; + int st; fread(buffer, size < 512 ? size : 512, 1, f); - if(tw_write(ssl, sock, buffer, size < 512 ? size : 512) < 0) return; + if((st = tw_write(ssl, sock, buffer, size < 512 ? size : 512)) <= 0) break; } else { - if(tw_write(ssl, sock, (unsigned char*)doc + incr, size < 512 ? size : 512) < 0) return; + if(tw_write(ssl, sock, (unsigned char*)doc + incr, size < 512 ? size : 512) <= 0) break; } incr += 512; if(size <= 512) break; @@ -1022,7 +1023,7 @@ void tw_server_loop(void) { struct timeval tv; #endif #if defined(__MINGW32__) || defined(__HAIKU__) || defined(_MSC_VER) || defined(__BORLANDC__) || (defined(__WATCOMC__) && !defined(__NETWARE__) && !defined(__DOS__)) - struct thread_entry threads[2048]; + struct thread_entry threads[128]; for(i = 0; i < sizeof(threads) / sizeof(threads[0]); i++) { threads[i].used = false; }