summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/core.c b/src/core.c
index 2b64347..d086dfe 100644
--- a/src/core.c
+++ b/src/core.c
@@ -148,7 +148,9 @@ static void tip_client_read_cb(struct ev_loop *loop, struct ev_io *io, int event
case TIP_CLIENT_PROCESSING_REQUEST:
ret = tip_client_state_process_payload(cli);
if (ret > 0) {
- /* client is pending. */
+ syslog(LOG_INFO, "client %s:%hu for %s enters pending state\n",
+ inet_ntoa(cli->addr.sin_addr),
+ ntohs(cli->addr.sin_port), cli->uri);
return;
} else if (ret < 0) {
syslog(LOG_ERR, "Failed to process HTTP request from %s:%hu\n",
@@ -157,6 +159,10 @@ static void tip_client_read_cb(struct ev_loop *loop, struct ev_io *io, int event
goto close;
}
+ syslog(LOG_INFO, "client %s:%hu starts download for %s\n",
+ inet_ntoa(cli->addr.sin_addr),
+ ntohs(cli->addr.sin_port), cli->uri);
+
ev_io_stop(loop, &cli->io);
ev_io_set(&cli->io, tip_client_socket(cli), EV_READ | EV_WRITE);
ev_io_start(loop, &cli->io);
@@ -320,8 +326,11 @@ static void tip_client_activate_pending(void)
if (cli->state != TIP_CLIENT_PENDING)
continue;
- tip_client_redirect(cli);
-
+ if (!tip_client_redirect(cli)) {
+ syslog(LOG_INFO, "sending %s to client %s:%hu",
+ cli->uri, inet_ntoa(cli->addr.sin_addr),
+ htons(cli->addr.sin_port));
+ }
ev_io_set(&cli->io, tip_client_socket(cli), EV_READ | EV_WRITE);
ev_io_start(tip_main_loop, &cli->io);
ev_timer_start(tip_main_loop, &cli->timer);
@@ -348,9 +357,10 @@ bool tip_client_redirect(struct tip_client *cli)
cli->redirect = true;
cli->redirect_addr = redir->addr;
- syslog(LOG_INFO, "redirecting client %s:%hu to %s:%hu",
+ syslog(LOG_INFO, "redirecting client %s:%hu to %s:%hu for %s",
addr, htons(cli->addr.sin_port),
- inet_ntoa(redir->addr.sin_addr), htons(redir->addr.sin_port));
+ inet_ntoa(redir->addr.sin_addr), htons(redir->addr.sin_port),
+ cli->uri);
free((void *)redir->uri);
ev_timer_stop(tip_main_loop, &redir->timer);