Code

frontend: Report back invalid commands.
authorSebastian Harl <sh@tokkee.org>
Sat, 23 Nov 2013 08:59:14 +0000 (09:59 +0100)
committerSebastian Harl <sh@tokkee.org>
Sat, 23 Nov 2013 08:59:14 +0000 (09:59 +0100)
src/frontend/connection.c

index 23bbb33920f2186b56004c5b3d8d52d5730a6b01..90361fe9a65b57a4ebaf8c855d3ca5d430b98f30 100644 (file)
@@ -73,9 +73,15 @@ command_handle(sdb_conn_t *conn)
                        status = sdb_session_start(conn);
                        break;
                default:
+               {
+                       char errbuf[1024];
                        sdb_log(SDB_LOG_WARNING, "frontend: Ignoring invalid command");
+                       snprintf(errbuf, sizeof(errbuf), "Invalid command %#x", conn->cmd);
+                       sdb_connection_send(conn, CONNECTION_ERROR,
+                                       (uint32_t)(strlen(errbuf) + 1), errbuf);
                        status = -1;
                        break;
+               }
        }
 
        /* remove the command from the buffer */