summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortiptorrent development team <tiptorrent@soleta.eu>2021-09-18 22:16:15 +0200
committertiptorrent development team <tiptorrent@soleta.eu>2021-09-18 22:16:29 +0200
commit388a3c1f45ad071380ec7c685dcc5a0d04c8c513 (patch)
tree774d6527bacd876d935f4c7fbf9a0fdea8cae999
parent24f629178d937d341de156313fa468ba6fce14bc (diff)
fix connect error path
Use syslog() and do not check for EINPROGRESS on the second connect() call.
-rw-r--r--src/main.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c
index c334049..a246bc6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -303,11 +303,9 @@ static void tip_client_connect_cb(struct ev_loop *loop, struct ev_io *io, int ev
len = sizeof(cli->addr);
ret = connect(cli->io.fd, (struct sockaddr *)&cli->addr, len);
if (ret < 0) {
- if (errno != EINPROGRESS) {
- perror("connect");
- tip_client_error(cli);
- return;
- }
+ syslog(LOG_ERR, "failed to connect to server to fetch %s", filename);
+ tip_client_error(cli);
+ return;
}
if (cli->state == TIP_CLIENT_NOTIFY_REDIRECT)
@@ -362,7 +360,8 @@ static int tip_client_connect(const char *addr)
len = sizeof(cli->addr);
ret = connect(remote_fd, (struct sockaddr *)&cli->addr, len);
if (ret < 0 && errno != EINPROGRESS) {
- perror("connect");
+ syslog(LOG_ERR, "failed to connect to server to fetch %s", filename);
+ tip_client_error(cli);
return ret;
}