Skip to content

Commit

Permalink
more descriptive UDP logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavidsaver committed Oct 2, 2018
1 parent 2fec844 commit d4f3abf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
3 changes: 0 additions & 3 deletions src/remote/blockingUDPConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ BlockingUDPTransport::shared_pointer BlockingUDPConnector::connect(std::tr1::sha
ResponseHandler::shared_pointer const & responseHandler, osiSockAddr& bindAddress,
int8 transportRevision, int16 /*priority*/) {

LOG(logLevelDebug, "Creating datagram socket to: %s.",
inetAddressToString(bindAddress).c_str());

SOCKET socket = epicsSocketCreate(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if(socket==INVALID_SOCKET) {
char errStr[64];
Expand Down
14 changes: 8 additions & 6 deletions src/remote/blockingUDPTransport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ BlockingUDPTransport::BlockingUDPTransport(bool serverFlag,
char strBuffer[64];
sockAddrToDottedIP(&_remoteAddress.sa, strBuffer, sizeof(strBuffer));
_remoteName = strBuffer;
LOG(logLevelDebug, "Creating datagram socket from: %s.",
_remoteName.c_str());
}

REFTRACE_INCREMENT(num_instances);
Expand Down Expand Up @@ -398,8 +400,8 @@ bool BlockingUDPTransport::send(const char* buffer, size_t length, const osiSock
{
if (IS_LOGGABLE(logLevelDebug))
{
LOG(logLevelDebug, "Sending %zu bytes to %s.",
length, inetAddressToString(address).c_str());
LOG(logLevelDebug, "Sending %zu bytes %s -> %s.",
length, _remoteName.c_str(), inetAddressToString(address).c_str());
}

int retval = sendto(_channel, buffer,
Expand All @@ -422,8 +424,8 @@ bool BlockingUDPTransport::send(ByteBuffer* buffer, const osiSockAddr& address)

if (IS_LOGGABLE(logLevelDebug))
{
LOG(logLevelDebug, "Sending %zu bytes to %s.",
buffer->getRemaining(), inetAddressToString(address).c_str());
LOG(logLevelDebug, "Sending %zu bytes %s -> %s.",
buffer->getRemaining(), _remoteName.c_str(), inetAddressToString(address).c_str());
}

int retval = sendto(_channel, buffer->getArray(),
Expand Down Expand Up @@ -459,8 +461,8 @@ bool BlockingUDPTransport::send(ByteBuffer* buffer, InetAddressType target) {

if (IS_LOGGABLE(logLevelDebug))
{
LOG(logLevelDebug, "Sending %zu bytes to %s.",
buffer->getRemaining(), inetAddressToString(_sendAddresses[i]).c_str());
LOG(logLevelDebug, "Sending %zu bytes %s -> %s.",
buffer->getRemaining(), _remoteName.c_str(), inetAddressToString(_sendAddresses[i]).c_str());
}

int retval = sendto(_channel, buffer->getArray(),
Expand Down

0 comments on commit d4f3abf

Please sign in to comment.