From d810db6f4967e0e53dca35a5f795fd94cb6c4d00 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Wed, 14 Feb 2018 21:30:09 +0100
Subject: [PATCH] Don't assert on communication error.
The serial communication is for sure to be considered an "external interface". Errors on external interfaces are not to be handled with an assert.
---
server/main.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/server/main.cpp b/server/main.cpp
index 3bcd36d..e5112e1 100644
--- a/server/main.cpp
+++ b/server/main.cpp
@@ -328,7 +328,7 @@ int main(int argc, char *argv[])
iTxLen = sp_blocking_write(pPort, pDriveData, 512, 5/*ms timeout*/);
if (iTxLen < 512)
{
- printf("Err: WriteLen=%d\n",iTxLen);
+ printf("Err: WriteLen=%d\n", iTxLen);
continue;
}
@@ -352,7 +352,11 @@ int main(int argc, char *argv[])
{
static unsigned char auBlockBuf[512 + 1];
int iReadLen = sp_blocking_read(pPort, auBlockBuf, 512 + 1, 30/*ms timeout*/);
- assert(iReadLen == 512 + 1);
+ if (iReadLen != 512 + 1)
+ {
+ printf("Err: ReadLen=%d\n", iReadLen);
+ continue;
+ }
iChksum = 0;
for (int i = 0; i < 512; i++)