43 HttpParser *parser; |
43 HttpParser *parser; |
44 } EventHttpIO; |
44 } EventHttpIO; |
45 |
45 |
46 SessionHandler* create_basic_session_handler() { |
46 SessionHandler* create_basic_session_handler() { |
47 BasicSessionHandler *handler = malloc(sizeof(BasicSessionHandler)); |
47 BasicSessionHandler *handler = malloc(sizeof(BasicSessionHandler)); |
48 handler->threadpool = threadpool_new(8); |
48 handler->threadpool = threadpool_new(4, 8); |
49 handler->sh.enqueue_connection = basic_enq_conn; |
49 handler->sh.enqueue_connection = basic_enq_conn; |
50 |
50 |
51 |
51 |
52 return (SessionHandler*)handler; |
52 return (SessionHandler*)handler; |
53 } |
53 } |
237 |
237 |
238 int evt_request_finish(event_handler_t *h, event_t *event) { |
238 int evt_request_finish(event_handler_t *h, event_t *event) { |
239 EventHttpIO *io = event->cookie; |
239 EventHttpIO *io = event->cookie; |
240 HttpParser *parser = io->parser; |
240 HttpParser *parser = io->parser; |
241 HTTPRequest *request = io->request; |
241 HTTPRequest *request = io->request; |
242 |
242 |
243 int r = handle_request(request, NULL); |
243 int r = handle_request(request, NULL); |
244 if(r != 0) { |
244 if(r != 0) { |
245 // TODO: error message |
245 // TODO: error message |
246 close(request->connection->fd); |
246 close(request->connection->fd); |
247 } |
247 } |