src/line_proto.c
changeset 45 71e65564afd2
parent 41 40f7aa051acb
child 47 7d4094eb3117
--- a/src/line_proto.c	Thu Mar 12 22:06:01 2009 +0200
+++ b/src/line_proto.c	Thu Mar 12 22:50:08 2009 +0200
@@ -40,16 +40,14 @@
 static err_t line_proto_schedule_events (struct line_proto *lp, short what);
 
 /**
- * Trigger the on_error callback
+ * An error occured which we could not recover from; the line_proto should now be considered corrupt.
  *
- * XXX: take error_info as an arg?
+ * Notify the user callback, which will probably call line_proto_release().
  */
-static void line_proto_handle_error (struct line_proto *lp)
+static void line_proto_set_error (struct line_proto *lp)
 {
     // trigger callback
     lp->callbacks.on_error(&lp->err, lp->cb_arg);
-
-    // XXX: do we handle release()? no
 }
 
 /**
@@ -69,9 +67,7 @@
         // attempt to read a line
         if (line_proto_recv(lp, &line)) {
             // faaail
-            line_proto_handle_error(lp);
-
-            return;
+            return line_proto_set_error(lp);
         }
 
         // got a line?
@@ -82,7 +78,7 @@
 
     // reschedule
     if (line_proto_schedule_events(lp, EV_READ))
-        line_proto_handle_error(lp);
+        line_proto_set_error(lp);
 }
 
 /*
@@ -100,7 +96,7 @@
         // faaaail
         SET_ERROR(&lp->err, -ret);
 
-        line_proto_handle_error(lp);
+        return line_proto_set_error(lp);
     }
 }