chiark / gitweb /
TODOs for all the protocol_error() calls that need fixed
authorRichard Kettlewell <rjk@greenend.org.uk>
Sat, 7 Jun 2008 19:13:59 +0000 (20:13 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sat, 7 Jun 2008 19:13:59 +0000 (20:13 +0100)
lib/eclient.c
lib/eclient.h

index a9805f7c4f5948d78e8703c6f93f800f4aedf4cb..d0e398a7d6fe5710bdfc2c11a97586a3e679f405 100644 (file)
@@ -519,6 +519,7 @@ static void maybe_connected(disorder_eclient *c) {
 
 /* Authentication ************************************************************/
 
 
 /* Authentication ************************************************************/
 
+/** @brief Called with the greeting from the server */
 static void authbanner_opcallback(disorder_eclient *c,
                                   struct operation *op) {
   size_t nonce_len;
 static void authbanner_opcallback(disorder_eclient *c,
                                   struct operation *op) {
   size_t nonce_len;
@@ -577,6 +578,7 @@ static void authbanner_opcallback(disorder_eclient *c,
                 (char *)0);
 }
 
                 (char *)0);
 }
 
+/** @brief Called with the response to the @c user command */
 static void authuser_opcallback(disorder_eclient *c,
                                 struct operation *op) {
   char *r;
 static void authuser_opcallback(disorder_eclient *c,
                                 struct operation *op) {
   char *r;
@@ -846,12 +848,14 @@ static void string_response_opcallback(disorder_eclient *c,
         if(rr && *rr)
           ((disorder_eclient_string_response *)op->completed)(op->v, *rr);
         else
         if(rr && *rr)
           ((disorder_eclient_string_response *)op->completed)(op->v, *rr);
         else
+          /* TODO don't use protocol_error here */
           protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
       } else
         ((disorder_eclient_string_response *)op->completed)(op->v,
                                                             c->line + 4);
     }
   } else
           protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
       } else
         ((disorder_eclient_string_response *)op->completed)(op->v,
                                                             c->line + 4);
     }
   } else
+    /* TODO don't use protocol_error here */
     protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
 }
 
     protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
 }
 
@@ -864,6 +868,7 @@ static void integer_response_opcallback(disorder_eclient *c,
       ((disorder_eclient_integer_response *)op->completed)
         (op->v, strtol(c->line + 4, 0, 10));
   } else
       ((disorder_eclient_integer_response *)op->completed)
         (op->v, strtol(c->line + 4, 0, 10));
   } else
+    /* TODO don't use protocol_error here */
     protocol_error(c, op,  c->rc, "%s: %s", c->ident, c->line);
 }
 
     protocol_error(c, op,  c->rc, "%s: %s", c->ident, c->line);
 }
 
@@ -875,6 +880,7 @@ static void no_response_opcallback(disorder_eclient *c,
     if(op->completed)
       ((disorder_eclient_no_response *)op->completed)(op->v);
   } else
     if(op->completed)
       ((disorder_eclient_no_response *)op->completed)(op->v);
   } else
+    /* TODO don't use protocol_error here */
     protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
 }
 
     protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
 }
 
@@ -883,6 +889,7 @@ static void eclient_queue_error(const char *msg,
                                 void *u) {
   struct operation *op = u;
 
                                 void *u) {
   struct operation *op = u;
 
+  /* TODO don't use protocol_error here */
   protocol_error(op->client, op, -1, "error parsing queue entry: %s", msg);
 }
 
   protocol_error(op->client, op, -1, "error parsing queue entry: %s", msg);
 }
 
@@ -908,6 +915,7 @@ static void queue_response_opcallback(disorder_eclient *c,
     if(op->completed)
       ((disorder_eclient_queue_response *)op->completed)(op->v, qh);
   } else
     if(op->completed)
       ((disorder_eclient_queue_response *)op->completed)(op->v, qh);
   } else
+    /* TODO don't use protocol_error here */
     protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
 } 
 
     protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
 } 
 
@@ -928,12 +936,14 @@ static void playing_response_opcallback(disorder_eclient *c,
       q = 0;
       break;
     default:
       q = 0;
       break;
     default:
+      /* TODO don't use protocol_error here */
       protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
       return;
     }
     if(op->completed)
       ((disorder_eclient_queue_response *)op->completed)(op->v, q);
   } else
       protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
       return;
     }
     if(op->completed)
       ((disorder_eclient_queue_response *)op->completed)(op->v, q);
   } else
+    /* TODO don't use protocol_error here */
     protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
 }
 
     protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
 }
 
@@ -947,6 +957,7 @@ static void list_response_opcallback(disorder_eclient *c,
                                                         c->vec.nvec,
                                                         c->vec.vec);
   } else
                                                         c->vec.nvec,
                                                         c->vec.vec);
   } else
+    /* TODO don't use protocol_error here */
     protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
 }
 
     protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
 }
 
@@ -959,12 +970,14 @@ static void volume_response_opcallback(disorder_eclient *c,
   if(c->rc / 100 == 2) {
     if(op->completed) {
       if(sscanf(c->line + 4, "%d %d", &l, &r) != 2 || l < 0 || r < 0)
   if(c->rc / 100 == 2) {
     if(op->completed) {
       if(sscanf(c->line + 4, "%d %d", &l, &r) != 2 || l < 0 || r < 0)
+        /* TODO don't use protocol_error here */
         protocol_error(c, op, -1, "%s: invalid volume response: %s",
                        c->ident, c->line);
       else
         ((disorder_eclient_volume_response *)op->completed)(op->v, l, r);
     }
   } else
         protocol_error(c, op, -1, "%s: invalid volume response: %s",
                        c->ident, c->line);
       else
         ((disorder_eclient_volume_response *)op->completed)(op->v, l, r);
     }
   } else
+    /* TODO don't use protocol_error here */
     protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
 }
 
     protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
 }
 
@@ -1242,6 +1255,7 @@ static void rtp_response_opcallback(disorder_eclient *c,
       ((disorder_eclient_list_response *)op->completed)(op->v, nvec, vec);
     }
   } else
       ((disorder_eclient_list_response *)op->completed)(op->v, nvec, vec);
     }
   } else
+    /* TODO don't use protocol_error here */
     protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
 }
 
     protocol_error(c, op, c->rc, "%s: %s", c->ident, c->line);
 }
 
@@ -1380,6 +1394,7 @@ static void log_opcallback(disorder_eclient *c,
 /* error callback for log line parsing */
 static void logline_error(const char *msg, void *u) {
   disorder_eclient *c = u;
 /* error callback for log line parsing */
 static void logline_error(const char *msg, void *u) {
   disorder_eclient *c = u;
+  /* TODO don't use protocol_error here */
   protocol_error(c, c->ops, -1, "error parsing log line: %s", msg);
 }
 
   protocol_error(c, c->ops, -1, "error parsing log line: %s", msg);
 }
 
@@ -1395,6 +1410,7 @@ static void logline(disorder_eclient *c, const char *line) {
                                          * reported */
   if(sscanf(vec[0], "%"SCNxMAX, &when) != 1) {
     /* probably the wrong side of a format change */
                                          * reported */
   if(sscanf(vec[0], "%"SCNxMAX, &when) != 1) {
     /* probably the wrong side of a format change */
+    /* TODO don't use protocol_error here */
     protocol_error(c, c->ops, -1, "invalid log timestamp '%s'", vec[0]);
     return;
   }
     protocol_error(c, c->ops, -1, "invalid log timestamp '%s'", vec[0]);
     return;
   }
index 157ad59301095a19556e0a2a9121de6e1c5cbf94..1b79cc0061ac7f3d411d92e91279c0726d28e046 100644 (file)
@@ -42,9 +42,13 @@ struct queue_entry;
  * These must all be valid.
  */
 typedef struct disorder_eclient_callbacks {
  * These must all be valid.
  */
 typedef struct disorder_eclient_callbacks {
-  /** @brief Called when a communication error (e.g. connected refused) occurs.
+  /** @brief Called when a communication error occurs.
    * @param u from disorder_eclient_new()
    * @param msg error message
    * @param u from disorder_eclient_new()
    * @param msg error message
+   *
+   * This might be called at any time, and indicates a low-level error,
+   * e.g. connection refused by the server.  It does not mean that any requests
+   * made of the owning eclient will not be fulfilled at some point.
    */
   void (*comms_error)(void *u, const char *msg);
   
    */
   void (*comms_error)(void *u, const char *msg);
   
@@ -52,6 +56,11 @@ typedef struct disorder_eclient_callbacks {
    * @param u from disorder_eclient_new()
    * @param v from failed command, or NULL if during setup
    * @param msg error message
    * @param u from disorder_eclient_new()
    * @param v from failed command, or NULL if during setup
    * @param msg error message
+   *
+   * This call is obsolete at least in its current form, in which it is used to
+   * report most errors from most requests.  Ultimately requests-specific
+   * errors will be reported in a request-specific way rather than via this
+   * generic callback.
    */
   void (*protocol_error)(void *u, void *v, int code, const char *msg);
 
    */
   void (*protocol_error)(void *u, void *v, int code, const char *msg);