Increase fiber stack size, change socket backlog to 10, rearrange commented out debug code

master
teknomunk 9 months ago
parent 3c4a1ff770
commit 036380387a

@ -396,7 +396,7 @@ struct http_request* http_request_new( ucontext_t* main, int sock, const char* r
req->complete = true;
return req;
}
req->context.uc_stack.ss_size = 16384;
req->context.uc_stack.ss_size = 16384 + 5000;
req->context.uc_stack.ss_sp = (char*)malloc( req->context.uc_stack.ss_size );
if( !req->context.uc_stack.ss_sp ) {
printf( "Failed to allocate stack for request.\n");

@ -80,7 +80,7 @@ struct http_server* http_server_new( struct http_server_args* args, http_server_
exit(1);
}
if( -1 == listen( srv->sock, 0 ) ) {
if( -1 == listen( srv->sock, 10 ) ) {
printf( "Unable to listen on %s:%d: %s\n",
args->bind_address, args->bind_port, strerror(errno)
);
@ -117,11 +117,10 @@ void http_server_process( struct http_server* srv )
}
} else {
// Handle connection
//uint64_t time;
/*
//*
struct timespec ts;
clock_gettime( CLOCK_MONOTONIC, &ts );
time = (uint64_t)ts.tv_sec * 1000000000 + (uint64_t)ts.tv_nsec;
uint64_t time = (uint64_t)ts.tv_sec * 1000000000 + (uint64_t)ts.tv_nsec;
printf( "Accepting connection at %ld\n", time );
//*/
srv->active += 1;
@ -147,11 +146,11 @@ void http_server_process( struct http_server* srv )
http_request_process( req, &srv->context );
count += 1;
}
/*
//*
if( count > 0 ) {
printf( "Processed %d requests\n", count );
}
*/
//*/
}
void http_server_release( struct http_server* srv )

Loading…
Cancel
Save