diff --git a/TimeoutSerial.cpp b/TimeoutSerial.cpp index eeb926e..4a41f56 100755 --- a/TimeoutSerial.cpp +++ b/TimeoutSerial.cpp @@ -235,7 +235,7 @@ void TimeoutSerial::timeoutExpired(const boost::system::error_code& error) void TimeoutSerial::readCompleted(const boost::system::error_code& error, const size_t bytesTransferred) { - if(!error) + if(!error || error.val) { result=resultSuccess; this->bytesTransferred=bytesTransferred; diff --git a/Ymodem.cpp b/Ymodem.cpp index 0f1cf7c..0b464bf 100644 --- a/Ymodem.cpp +++ b/Ymodem.cpp @@ -270,6 +270,8 @@ Ymodem::Code Ymodem::receivePacket() { uint32_t len = read(&(rxBuffer[1]), YMODEM_PACKET_SIZE + YMODEM_PACKET_OVERHEAD - 1); + BOOST_LOG_TRIVIAL(debug) << "Len = " << len; + if(len < (YMODEM_PACKET_SIZE + YMODEM_PACKET_OVERHEAD - 1)) { rxLength = len + 1;