commit - 3f47867e1df312b3a0c6229c18cce79ad52063d9
commit + 74c0c7e4ce3d0e576ce14a8928a9972d15010c1f
blob - 23afd9356cba4b2451e142d0163e68ee098bcd4f
blob + 47b1bb0d5e4c0e1ce5f613bbf3d3b0a1304910c4
--- server.c
+++ server.c
static inline int matches(const char*, const char*);
-static inline void reschedule_read(int, struct client*, statefn);
-static inline void reschedule_write(int, struct client*, statefn);
+static inline void yield_read(int, struct client*, statefn);
+static inline void yield_write(int, struct client*, statefn);
static int check_path(struct client*, const char*, int*);
static void open_file(struct client*);
}
static inline void
-reschedule_read(int fd, struct client *c, statefn fn)
+yield_read(int fd, struct client *c, statefn fn)
{
event_once(fd, EV_READ, fn, c, NULL);
}
static inline void
-reschedule_write(int fd, struct client *c, statefn fn)
+yield_write(int fd, struct client *c, statefn fn)
{
event_once(fd, EV_WRITE, fn, c, NULL);
}
case -1: /* already handshaked */
break;
case TLS_WANT_POLLIN:
- reschedule_read(fd, c, &handle_handshake);
+ yield_read(fd, c, &handle_handshake);
return;
case TLS_WANT_POLLOUT:
- reschedule_write(fd, c, &handle_handshake);
+ yield_write(fd, c, &handle_handshake);
return;
default:
/* unreachable */
return;
case TLS_WANT_POLLIN:
- reschedule_read(fd, c, &handle_open_conn);
+ yield_read(fd, c, &handle_open_conn);
return;
case TLS_WANT_POLLOUT:
- reschedule_write(fd, c, &handle_open_conn);
+ yield_write(fd, c, &handle_open_conn);
return;
}
close_conn(fd, ev, c);
return;
case TLS_WANT_POLLIN:
- reschedule_read(fd, c, &handle_start_reply);
+ yield_read(fd, c, &handle_start_reply);
return;
case TLS_WANT_POLLOUT:
- reschedule_write(fd, c, &handle_start_reply);
+ yield_write(fd, c, &handle_start_reply);
return;
}
close_conn(fd, ev, c);
return;
case TLS_WANT_POLLOUT:
- reschedule_read(fd, c, &handle_dirlist);
+ yield_read(fd, c, &handle_dirlist);
return;
case TLS_WANT_POLLIN:
- reschedule_write(fd, c, &handle_dirlist);
+ yield_write(fd, c, &handle_dirlist);
return;
default:
c->off += r;
goto end;
case TLS_WANT_POLLOUT:
- reschedule_read(fd, c, &send_directory_listing);
+ yield_read(fd, c, &send_directory_listing);
return;
case TLS_WANT_POLLIN:
- reschedule_write(fd, c, &send_directory_listing);
+ yield_write(fd, c, &send_directory_listing);
return;
default:
return;
}
- reschedule_read(fd, c, &handle_cgi_reply);
+ yield_read(fd, c, &handle_cgi_reply);
}
static void
goto end;
case TLS_WANT_POLLOUT:
- reschedule_write(c->fd, c, &handle_copy);
+ yield_write(c->fd, c, &handle_copy);
return;
case TLS_WANT_POLLIN:
- reschedule_read(c->fd, c, &handle_copy);
+ yield_read(c->fd, c, &handle_copy);
return;
default:
goto end;
case -1:
if (errno == EAGAIN || errno == EWOULDBLOCK) {
- reschedule_read(c->pfd, c, &handle_copy);
+ yield_read(c->pfd, c, &handle_copy);
return;
}
goto end;
switch (tls_close(c->ctx)) {
case TLS_WANT_POLLIN:
- reschedule_read(fd, c, &close_conn);
+ yield_read(fd, c, &close_conn);
return;
case TLS_WANT_POLLOUT:
- reschedule_read(fd, c, &close_conn);
+ yield_read(fd, c, &close_conn);
return;
}
c->dir = NULL;
c->addr = addr;
- reschedule_read(fd, c, &handle_handshake);
+ yield_read(fd, c, &handle_handshake);
connected_clients++;
return;
}
if ((c->pfd = imsg->fd) == -1)
start_reply(c, TEMP_FAILURE, "internal server error");
else
- reschedule_read(c->pfd, c, &handle_cgi_reply);
+ yield_read(c->pfd, c, &handle_cgi_reply);
}
static void