From f277a8aa3c4a973614e7dc70dc3b32449e69baaa Mon Sep 17 00:00:00 2001 From: R3ABM Artem Date: Mon, 16 Jan 2023 13:20:48 +0000 Subject: [PATCH] Update TellusAgent.c --- TellusAgent.c | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/TellusAgent.c b/TellusAgent.c index 547ce74..4a28d87 100644 --- a/TellusAgent.c +++ b/TellusAgent.c @@ -496,31 +496,6 @@ int main(int argc, const char* argv[]) // Handle packet from the repeater - if (CHECK(event, proxyHandles[0])) - { - struct msghdr message; - struct iovec vectors[2]; - - watchDog ++; - - outgoingBuffer->type = htole16(REWIND_TYPE_BINDING_NOTICE); - outgoingBuffer->length = htole16(sizeof(proxyPorts)); - - vectors[0].iov_base = outgoingBuffer; - vectors[0].iov_len = sizeof(struct RewindData); - vectors[1].iov_base = proxyPorts; - vectors[1].iov_len = sizeof(proxyPorts); - message.msg_name = serverAddress->ai_addr; - message.msg_namelen = serverAddress->ai_addrlen; - message.msg_iov = vectors; - message.msg_iovlen = 2; - message.msg_control = NULL; - message.msg_controllen = 0; - message.msg_flags = 0; - - sendmsg(uplinkHandle, &message, 0); - } - for (selection = 0; selection < PROXY_PORT_COUNT; selection ++) { int handle = proxyHandles[selection]; @@ -531,6 +506,32 @@ int main(int argc, const char* argv[]) struct sockaddr_in* address = repeaterSocketAddresses + selection; size_t length = recvfrom(handle, buffer, BUFFER_SIZE, 0, (struct sockaddr*)address, &size); + if ((selection == 0) && + (memcmp(buffer, "HMTP", 4) != 0)) + { + struct msghdr message; + struct iovec vectors[2]; + + watchDog ++; + + outgoingBuffer->type = htole16(REWIND_TYPE_BINDING_NOTICE); + outgoingBuffer->length = htole16(sizeof(proxyPorts)); + + vectors[0].iov_base = outgoingBuffer; + vectors[0].iov_len = sizeof(struct RewindData); + vectors[1].iov_base = proxyPorts; + vectors[1].iov_len = sizeof(proxyPorts); + message.msg_name = serverAddress->ai_addr; + message.msg_namelen = serverAddress->ai_addrlen; + message.msg_iov = vectors; + message.msg_iovlen = 2; + message.msg_control = NULL; + message.msg_controllen = 0; + message.msg_flags = 0; + + sendmsg(uplinkHandle, &message, 0); + } + outgoingBuffer->type = htole16(REWIND_CLASS_HYTERA_DATA + selection); outgoingBuffer->length = htole16(length);