Log some error conditions (kill some TODOs)
authorDavin McCall <davmac@davmac.org>
Tue, 21 Jun 2016 15:11:10 +0000 (16:11 +0100)
committerDavin McCall <davmac@davmac.org>
Tue, 21 Jun 2016 15:11:10 +0000 (16:11 +0100)
src/control.cc

index a887d271c85fabf9b1dd42ae7b25bd10c5732e44..4e0c72a076b83666e5e037904b8149cb0d4a95d1 100644 (file)
@@ -278,7 +278,7 @@ bool ControlConn::queuePacket(const char *pkt, unsigned size) noexcept
                 return false;
             }
             if (errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR) {
-                // TODO log error
+                log(LogLevel::WARN, "Error writing to control connection: ", strerror(errno));
                 return false;
             }
             // EAGAIN etc: fall through to below
@@ -333,7 +333,7 @@ bool ControlConn::queuePacket(std::vector<char> &&pkt) noexcept
                 return false;
             }
             if (errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR) {
-                // TODO log error
+                log(LogLevel::WARN, "Error writing to control connection: ", strerror(errno));
                 return false;
             }
             // EAGAIN etc: fall through to below
@@ -385,7 +385,7 @@ bool ControlConn::dataReady() noexcept
     // Note file descriptor is non-blocking
     if (r == -1) {
         if (errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR) {
-            // TODO log error
+            log(LogLevel::WARN, "Error writing to control connection: ", strerror(errno));
             return true;
         }
         return false;
@@ -407,8 +407,7 @@ bool ControlConn::dataReady() noexcept
     }
     else if (rbuf.get_length() == 1024) {
         // Too big packet
-        // TODO log error?
-        // TODO error response?
+        log(LogLevel::WARN, "Received too-large control package; dropping connection");
         bad_conn_close = true;
         iob.setWatches(OUT_EVENTS);
     }