--- a/src/irc_conn.c Thu Mar 12 22:06:01 2009 +0200
+++ b/src/irc_conn.c Thu Mar 12 22:50:08 2009 +0200
@@ -7,14 +7,19 @@
#include <string.h>
/**
- * @group Forward-declerations
- * @{
+ * Handle an async error on this IRC connection that we could not recover from any other way, the protocol is now dead,
+ * and should be considered as destroyed after this returns.
+ *
+ * For conveniance, this returns the ERROR_CODE
*/
+static err_t irc_conn_set_error (struct irc_conn *conn, struct error_info *err)
+{
+ // notify user callback
+ conn->callbacks.on_error(conn, err, conn->cb_arg);
-/**
- * Handle an event-based error on this IRC connection.
- */
-static void irc_conn_handle_error (struct irc_conn *conn, struct error_info *err);
+ return ERROR_CODE(err);
+}
+
/**
* Update irc_conn.nickname
@@ -28,17 +33,13 @@
SET_ERROR(&err, ERR_STRDUP);
// notify
- irc_conn_handle_error(conn, &err);
-
- return ERROR_CODE(&err);
+ return irc_conn_set_error(conn, &err);
}
// ok
return SUCCESS;
}
-// @}
-
/**
* 001 <nick> :Welcome to the Internet Relay Network <nick>!<user>@<host>
*/
@@ -138,8 +139,8 @@
// log
log_err_info(err, "line_proto error");
- // 'handle'
- irc_conn_handle_error(conn, err);
+ // trash ourselves
+ irc_conn_set_error(conn, err);
}
static struct line_proto_callbacks _lp_callbacks = {
@@ -147,11 +148,6 @@
.on_error = &irc_conn_on_error,
};
-static void irc_conn_handle_error (struct irc_conn *conn, struct error_info *err)
-{
- // XXX: notify user callback
-}
-
err_t irc_conn_create (struct irc_conn **conn_ptr, struct sock_stream *sock, const struct irc_conn_callbacks *callbacks,
void *cb_arg, struct error_info *err)
{