summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd/check_tcp.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2008-03-03 16:58:42 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2008-03-03 16:58:42 +0000
commitbc77df0ac0f6905778b19a8a6b3a7aa83dd0959f (patch)
tree27e5ce7c58f7847d02705120b723a4e8b458384a /usr.sbin/relayd/check_tcp.c
parentf49ac8c2d51506de5146e7722e2ebb53d37be0d5 (diff)
log a different notification message when the tcp check times out.
also adjust the documentation a little bit to decrease confusion about the check timeout. From pyr@ ok deraadt@
Diffstat (limited to 'usr.sbin/relayd/check_tcp.c')
-rw-r--r--usr.sbin/relayd/check_tcp.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/usr.sbin/relayd/check_tcp.c b/usr.sbin/relayd/check_tcp.c
index cf83dcec3ac..00245fc9d76 100644
--- a/usr.sbin/relayd/check_tcp.c
+++ b/usr.sbin/relayd/check_tcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: check_tcp.c,v 1.31 2007/12/07 17:17:00 reyk Exp $ */
+/* $OpenBSD: check_tcp.c,v 1.32 2008/03/03 16:58:41 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -107,24 +107,24 @@ tcp_write(int s, short event, void *arg)
socklen_t len;
if (event == EV_TIMEOUT) {
- log_debug("tcp_write: connect timed out");
+ close(s);
cte->host->up = HOST_DOWN;
- } else {
- len = sizeof(err);
- if (getsockopt(s, SOL_SOCKET, SO_ERROR, &err, &len))
- fatal("tcp_write: getsockopt");
- if (err != 0)
- cte->host->up = HOST_DOWN;
- else
- cte->host->up = HOST_UP;
+ hce_notify_done(cte->host, "tcp_write: connect timed out");
+ return;
}
- if (cte->host->up == HOST_UP)
- tcp_host_up(s, cte);
- else {
+ len = sizeof(err);
+ if (getsockopt(s, SOL_SOCKET, SO_ERROR, &err, &len))
+ fatal("tcp_write: getsockopt");
+ if (err != 0) {
close(s);
+ cte->host->up = HOST_DOWN;
hce_notify_done(cte->host, "tcp_write: connect failed");
+ return;
}
+
+ cte->host->up = HOST_UP;
+ tcp_host_up(s, cte);
}
void