davidmoreno / onion

C library to create simple HTTP servers and Web Applications.
http://www.coralbits.com/libonion/
Other
2.02k stars 250 forks source link

Is there a way to have keepalive on when in O_ONE_LOOP mode? #259

Open bootrino opened 4 years ago

bootrino commented 4 years ago

Hello,

I start onion like this:

onion *o=onion_new(O_ONE_LOOP );

But in this mode it seems to close connection after each request. I would like to keep the connection alive. Is this possible?

thanks!

bootrino commented 4 years ago

Please disregard and close this issue... I figured out I could just set number of threads to 1.

onion_set_max_threads(o, 1);

That seems to work fine.

Strangely, the simple test I do of 1000 requests takes 29 seconds in O_ONE_LOOP mode and 50 seconds or more in O_THREADED mode.

Doesn't really matter why though because I really want to run in O_ONE_LOOP mode, so a good outcome.