Skip to content

Instantly share code, notes, and snippets.

@methane
Created October 19, 2012 09:29
Show Gist options
  • Select an option

  • Save methane/3917160 to your computer and use it in GitHub Desktop.

Select an option

Save methane/3917160 to your computer and use it in GitHub Desktop.
@@ -1203,9 +1201,17 @@ accept_callback(picoev_loop* loop, int fd, int events, void* cb_arg)
remote_port = ntohs(client_addr.sin_port);
client = new_client_t(client_fd, remote_addr, remote_port);
init_parser(client, server_name, server_port);
- ret = picoev_add(loop, client_fd, PICOEV_READ, keep_alive_timeout, read_callback, (void *)client);
- if(ret == 0){
- activecnt++;
+ {
+ int finish = read_request(loop, client_fd, client);
+ if (finish) {
+ prepare_call_wsgi(client);
+ call_wsgi_handler(client);
+ } else {
+ ret = picoev_add(loop, client_fd, PICOEV_READ, keep_alive_timeout, read_callback, (void *)client);
+ if(ret == 0){
+ activecnt++;
+ }
+ }
}
}else{
if (errno != EAGAIN && errno != EWOULDBLOCK) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment