summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2011-03-01 13:56:49 +0100
committerLinus Nordberg <linus@nordu.net>2011-03-01 13:56:49 +0100
commit5831beb31310a2305348b9f2fbbef93659e12d07 (patch)
treea99b0fd9ae5a3434f4126da525970bf88f94cd32 /lib
parent809dbe710fe6aa1a7d7369e1ad78ea916e2b874f (diff)
Error handling cleanup 3.
Split timeout errors in connecting and I/O.
Diffstat (limited to 'lib')
-rw-r--r--lib/err.c3
-rw-r--r--lib/include/radsec/radsec.h3
-rw-r--r--lib/packet.c4
3 files changed, 6 insertions, 4 deletions
diff --git a/lib/err.c b/lib/err.c
index 650c05e..1e1dfaf 100644
--- a/lib/err.c
+++ b/lib/err.c
@@ -27,8 +27,9 @@ static const char *_errtxt[] = {
"internal error", /* 13 RSE_INTERNAL */
"SSL error", /* 14 RSE_SSLERR */
"invalid packet", /* 15 RSE_INVALID_PKT */
- "I/O timeout", /* 16 RSE_IOTIMEOUT */
+ "connect timeout", /* 16 RSE_TIMEOUT_CONN */
"invalid argument", /* 17 RSE_INVAL */
+ "I/O timeout", /* 18 RSE_TIMEOUT_IO */
};
#define ERRTXT_SIZE (sizeof(_errtxt) / sizeof(*_errtxt))
diff --git a/lib/include/radsec/radsec.h b/lib/include/radsec/radsec.h
index 75ed522..34298cd 100644
--- a/lib/include/radsec/radsec.h
+++ b/lib/include/radsec/radsec.h
@@ -21,8 +21,9 @@ enum rs_err_code {
RSE_INTERNAL = 13,
RSE_SSLERR = 14, /* OpenSSL error. */
RSE_INVALID_PKT = 15,
- RSE_IOTIMEOUT = 16,
+ RSE_TIMEOUT_CONN = 16,
RSE_INVAL = 17,
+ RSE_TIMEOUT_IO = 18,
};
enum rs_conn_type {
diff --git a/lib/packet.c b/lib/packet.c
index 6760cee..9527012 100644
--- a/lib/packet.c
+++ b/lib/packet.c
@@ -132,7 +132,7 @@ _event_cb (struct bufferevent *bev, short events, void *ctx)
{
rs_debug (("%s: %p times out on %s\n", __func__, p,
(events & BEV_EVENT_READING) ? "read" : "write"));
- rs_err_conn_push_fl (pkt->conn, RSE_IOTIMEOUT, __FILE__, __LINE__, NULL);
+ rs_err_conn_push_fl (pkt->conn, RSE_TIMEOUT_IO, __FILE__, __LINE__, NULL);
}
else if (events & BEV_EVENT_ERROR)
{
@@ -439,7 +439,7 @@ _conn_timeout_cb (int fd, short event, void *data)
rs_debug (("%s: connection timeout on %p (fd %d) connecting to %p\n",
__func__, conn, conn->fd, conn->active_peer));
conn->is_connecting = 0;
- rs_err_conn_push_fl (conn, RSE_IOTIMEOUT, __FILE__, __LINE__, NULL);
+ rs_err_conn_push_fl (conn, RSE_TIMEOUT_IO, __FILE__, __LINE__, NULL);
_loopbreak (conn);
}
}