serial backend socket fixes

- increase delay to 800 consecutive characters (reduces times when Open Firmware throws away pasted text)
- don't log the first sock read error (when accept hasn't been called yet) but do log sock read error if accept was called successfully already.
This commit is contained in:
joevt 2022-08-22 03:24:21 -07:00
parent 3ee2ea1871
commit 67b7c86755

View File

@ -340,7 +340,7 @@ bool CharIoSocket::rcv_char_available()
if (consecutivechars >= 15) { if (consecutivechars >= 15) {
consecutivechars++; consecutivechars++;
if (consecutivechars >= 400) if (consecutivechars >= 800)
consecutivechars = 0; consecutivechars = 0;
return 0; return 0;
} }
@ -378,14 +378,19 @@ bool CharIoSocket::rcv_char_available()
if (FD_ISSET(sockfd, &readfds)) { if (FD_ISSET(sockfd, &readfds)) {
uint8_t c; uint8_t c;
int received = recv(sockfd, &c, 1, 0); int received = recv(sockfd, &c, 1, 0);
if (received == -1 && acceptfd != -1) { if (received == -1) {
LOG_F(INFO, "socket sock read err: %s", strerror(errno)); if (acceptfd == -1) {
} //LOG_F(INFO, "socket sock read (not accepted yet) err: %s", strerror(errno)); // this happens once before accept
else if (received == 1) {
LOG_F(INFO, "socket sock read '%c'", c);
} }
else { else {
LOG_F(INFO, "socket sock read %d", received); LOG_F(INFO, "socket sock read err: %s", strerror(errno)); // should never happen
}
}
else if (received == 1) {
LOG_F(INFO, "socket sock read '%c'", c); // should never happen
}
else {
LOG_F(INFO, "socket sock read %d", received); // should never happen
} }
if (acceptfd == -1) { if (acceptfd == -1) {