From 1cf05a4e566bbf6c0db27f30b49406f60e52bfb1 Mon Sep 17 00:00:00 2001 From: RYAN RIVERA Date: Tue, 24 Mar 2026 15:45:58 -0500 Subject: [PATCH 1/7] Socket throttling allowing associated with testing Macromaker server with large system (Mu2e at MC-2) --- otsdaq/NetworkUtilities/TransceiverSocket.cc | 4 +++- otsdaq/NetworkUtilities/TransceiverSocket.h | 6 ++++-- tools/ots | 6 ++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/otsdaq/NetworkUtilities/TransceiverSocket.cc b/otsdaq/NetworkUtilities/TransceiverSocket.cc index c894acf3..d139511f 100644 --- a/otsdaq/NetworkUtilities/TransceiverSocket.cc +++ b/otsdaq/NetworkUtilities/TransceiverSocket.cc @@ -27,7 +27,8 @@ TransceiverSocket::~TransceiverSocket(void) {} /// returns 0 on success int TransceiverSocket::acknowledge(const std::string& buffer, bool verbose /* = false */, - size_t maxChunkSize /* = 1500 */) + size_t maxChunkSize /* = 1500 */, + unsigned int interPacketGapUSeconds /* = 0 */) { // lockout other senders for the remainder of the scope std::lock_guard lock(sendMutex_); @@ -59,6 +60,7 @@ int TransceiverSocket::acknowledge(const std::string& buffer, (struct sockaddr*)&(ReceiverSocket::fromAddress_), sizeof(sockaddr_in)); offset += sendToSize / sizeInBytes; + usleep(interPacketGapUSeconds); } if(sendToSize <= 0) diff --git a/otsdaq/NetworkUtilities/TransceiverSocket.h b/otsdaq/NetworkUtilities/TransceiverSocket.h index 6b06f22f..a0f63610 100644 --- a/otsdaq/NetworkUtilities/TransceiverSocket.h +++ b/otsdaq/NetworkUtilities/TransceiverSocket.h @@ -14,9 +14,11 @@ class TransceiverSocket : public TransmitterSocket, public ReceiverSocket TransceiverSocket(std::string IPAddress, unsigned int port = 0); virtual ~TransceiverSocket(void); - int acknowledge(const std::string& buffer, + /// acknowledge() responds to last receive location + int acknowledge(const std::string& buffer, bool verbose = false, - size_t maxChunkSize = 1500); ///< responds to last receive location + size_t maxChunkSize = 1500, + unsigned int interPacketGapUSeconds = 0); std::string sendAndReceive(Socket& toSocket, const std::string& sendBuffer, diff --git a/tools/ots b/tools/ots index 027f2118..462c6184 100644 --- a/tools/ots +++ b/tools/ots @@ -916,6 +916,12 @@ launchOTSMacromaker() { out "${Blue}${REV} ${RstClr}${Reset}" #Reset needed to prevent highlight of text in reverse searches after this output out #blank line + if [ "x$OTS_MACROMAKER_UDP_IP" == "x" ] || [ "x$OTS_MACROMAKER_UDP_PORT" == "x" ]; then + warning "If you would like to enable command-line access to your MacroMaker mode instance, then before launching please set an IP/PORT compatible with the systems networking interfaces at environment variables OTS_MACROMAKER_UDP_IP and OTS_MACROMAKER_UDP_PORT" + out #blank line + fi + + unset ContextPIDArray #reset unset ContextPIDNameArray #reset unset ContextPIDIsAliveArray #reset From fb820c1473a029200caf96217f4f0cd1286b543c Mon Sep 17 00:00:00 2001 From: RYAN RIVERA Date: Tue, 24 Mar 2026 15:46:24 -0500 Subject: [PATCH 2/7] Format fix --- otsdaq/NetworkUtilities/TransceiverSocket.cc | 2 +- otsdaq/NetworkUtilities/TransceiverSocket.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/otsdaq/NetworkUtilities/TransceiverSocket.cc b/otsdaq/NetworkUtilities/TransceiverSocket.cc index d139511f..13760009 100644 --- a/otsdaq/NetworkUtilities/TransceiverSocket.cc +++ b/otsdaq/NetworkUtilities/TransceiverSocket.cc @@ -28,7 +28,7 @@ TransceiverSocket::~TransceiverSocket(void) {} int TransceiverSocket::acknowledge(const std::string& buffer, bool verbose /* = false */, size_t maxChunkSize /* = 1500 */, - unsigned int interPacketGapUSeconds /* = 0 */) + unsigned int interPacketGapUSeconds /* = 0 */) { // lockout other senders for the remainder of the scope std::lock_guard lock(sendMutex_); diff --git a/otsdaq/NetworkUtilities/TransceiverSocket.h b/otsdaq/NetworkUtilities/TransceiverSocket.h index a0f63610..2888a5c7 100644 --- a/otsdaq/NetworkUtilities/TransceiverSocket.h +++ b/otsdaq/NetworkUtilities/TransceiverSocket.h @@ -15,10 +15,10 @@ class TransceiverSocket : public TransmitterSocket, public ReceiverSocket virtual ~TransceiverSocket(void); /// acknowledge() responds to last receive location - int acknowledge(const std::string& buffer, - bool verbose = false, - size_t maxChunkSize = 1500, - unsigned int interPacketGapUSeconds = 0); + int acknowledge(const std::string& buffer, + bool verbose = false, + size_t maxChunkSize = 1500, + unsigned int interPacketGapUSeconds = 0); std::string sendAndReceive(Socket& toSocket, const std::string& sendBuffer, From e18e1ce623a0c1c561d3ba83f2cf0eb38e0360da Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Mar 2026 01:43:26 +0000 Subject: [PATCH 3/7] Fix usleep: skip when gap==0 and skip after last packet Co-authored-by: rrivera747 <107584474+rrivera747@users.noreply.github.com> Agent-Logs-Url: https://github.com/art-daq/otsdaq/sessions/99058509-4306-48e1-9f75-81d6dc866efc --- otsdaq/NetworkUtilities/TransceiverSocket.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/otsdaq/NetworkUtilities/TransceiverSocket.cc b/otsdaq/NetworkUtilities/TransceiverSocket.cc index 13760009..c2606473 100644 --- a/otsdaq/NetworkUtilities/TransceiverSocket.cc +++ b/otsdaq/NetworkUtilities/TransceiverSocket.cc @@ -3,7 +3,6 @@ #include "otsdaq/MessageFacility/MessageFacility.h" #include -#include // std::this_thread using namespace ots; @@ -60,7 +59,8 @@ int TransceiverSocket::acknowledge(const std::string& buffer, (struct sockaddr*)&(ReceiverSocket::fromAddress_), sizeof(sockaddr_in)); offset += sendToSize / sizeInBytes; - usleep(interPacketGapUSeconds); + if(interPacketGapUSeconds > 0 && offset < buffer.size() && sendToSize > 0) + usleep(interPacketGapUSeconds); } if(sendToSize <= 0) From 35258e77801e5f14ce2e758a9c06879f5ccd6339 Mon Sep 17 00:00:00 2001 From: RYAN RIVERA Date: Wed, 25 Mar 2026 11:45:47 -0500 Subject: [PATCH 4/7] Better warning --- tools/ots | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ots b/tools/ots index 462c6184..45d8fd61 100644 --- a/tools/ots +++ b/tools/ots @@ -917,7 +917,7 @@ launchOTSMacromaker() { out #blank line if [ "x$OTS_MACROMAKER_UDP_IP" == "x" ] || [ "x$OTS_MACROMAKER_UDP_PORT" == "x" ]; then - warning "If you would like to enable command-line access to your MacroMaker mode instance, then before launching please set an IP/PORT compatible with the systems networking interfaces at environment variables OTS_MACROMAKER_UDP_IP and OTS_MACROMAKER_UDP_PORT" + warning "If you would like to enable command-line access to your MacroMaker mode instance, then before launching please set an IP/PORT compatible with the the system's networking interfaces using environment variables OTS_MACROMAKER_UDP_IP and OTS_MACROMAKER_UDP_PORT" out #blank line fi From 7dd8c9da0a053963659304fb86345afb883f0e8d Mon Sep 17 00:00:00 2001 From: RYAN RIVERA Date: Wed, 25 Mar 2026 12:32:56 -0500 Subject: [PATCH 5/7] Format fix --- otsdaq/NetworkUtilities/TransceiverSocket.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/otsdaq/NetworkUtilities/TransceiverSocket.cc b/otsdaq/NetworkUtilities/TransceiverSocket.cc index c2606473..a93cc091 100644 --- a/otsdaq/NetworkUtilities/TransceiverSocket.cc +++ b/otsdaq/NetworkUtilities/TransceiverSocket.cc @@ -2,7 +2,10 @@ #include "otsdaq/Macros/CoutMacros.h" #include "otsdaq/MessageFacility/MessageFacility.h" +#include #include +#include +#include using namespace ots; From 22446d14751578a664f76f91f39f3e7c92540678 Mon Sep 17 00:00:00 2001 From: rrivera747 <107584474+rrivera747@users.noreply.github.com> Date: Wed, 25 Mar 2026 13:49:49 -0500 Subject: [PATCH 6/7] Update otsdaq/NetworkUtilities/TransceiverSocket.cc Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- otsdaq/NetworkUtilities/TransceiverSocket.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/otsdaq/NetworkUtilities/TransceiverSocket.cc b/otsdaq/NetworkUtilities/TransceiverSocket.cc index a93cc091..ee66ab79 100644 --- a/otsdaq/NetworkUtilities/TransceiverSocket.cc +++ b/otsdaq/NetworkUtilities/TransceiverSocket.cc @@ -6,6 +6,7 @@ #include #include #include +#include using namespace ots; From 452c98247c3f5f00c9b33f8eed0edfc54e765519 Mon Sep 17 00:00:00 2001 From: RYAN RIVERA Date: Wed, 25 Mar 2026 14:57:22 -0500 Subject: [PATCH 7/7] Format fix --- otsdaq/NetworkUtilities/TransceiverSocket.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/otsdaq/NetworkUtilities/TransceiverSocket.cc b/otsdaq/NetworkUtilities/TransceiverSocket.cc index ee66ab79..607d2720 100644 --- a/otsdaq/NetworkUtilities/TransceiverSocket.cc +++ b/otsdaq/NetworkUtilities/TransceiverSocket.cc @@ -2,11 +2,11 @@ #include "otsdaq/Macros/CoutMacros.h" #include "otsdaq/MessageFacility/MessageFacility.h" +#include #include #include #include #include -#include using namespace ots;