MT#55283 homer: reset TCP connection on EOF before sending HEP frames

Closes #2202

Change-Id: I4a7f68d047ceded75c27252edd7fd8d8158e59c2
(cherry picked from commit 93bcecac45)
mr26.3
Darwvin 1 month ago committed by Richard Fuchs
parent 87782799f2
commit 4ada816238

@ -93,8 +93,16 @@ static int __established(struct homer_sender *hs) {
int ret;
GString *gs;
// test connection with a dummy read
// Check for peer shutdown before writing another HEP frame.
ret = read(hs->socket.fd, buf, sizeof(buf));
if (ret == 0 && hs->protocol == SOCK_STREAM) {
// A TCP read of zero bytes means that the peer has closed the
// connection. Never reuse this socket for the next HEP frame.
ilog(LOG_NOTICE, "Homer TCP connection at %s closed by peer",
endpoint_print_buf(&hs->endpoint));
__reset(hs);
return -1;
}
if (ret < 0) {
if (errno != EWOULDBLOCK && errno != EAGAIN) {
ilog(LOG_ERR, "Connection error from Homer at %s: %s",

Loading…
Cancel
Save