Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyp11 committed Aug 2, 2018
2 parents d5fb174 + fb42c0c commit 2cc42ca
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions McastModuleInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ class McastModuleInterface
int joinMcastIfaceV6(int sock, const char* ifaceName = "");

protected:
vector<IfaceData> mIfaces; // all interfaces to be listened/sent to
vector<string> mMcastAddresses;
int mMcastPort, mAckPort;
vector<IfaceData> mIfaces; // all interfaces to be listened/sent to
vector<string> mMcastAddresses;
int mMcastPort, mAckPort;

private:
bool mIsIpV6;
Expand Down
6 changes: 4 additions & 2 deletions ReceiverModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,14 @@ bool ReceiverModule::run()
{
// Retrieve the fd that has data
int fd = -1;
std::string recvIface = "default";
for (unsigned ii = 0; ii < mIfaces.size(); ++ii)
{
fd = mIfaces[ii].sockFd;
if (FD_ISSET(fd, &rfds))
{
FD_CLR(fd, &rfds);
recvIface = mIfaces[ii].ifaceName;
break;
}
}
Expand Down Expand Up @@ -164,11 +166,11 @@ bool ReceiverModule::run()
{
if (isIpV6())
{
printf("%-40s - %s\n", senderIp, decodedMsg.c_str());
printf("%-40s -> %-15s - %s\n", senderIp, recvIface.c_str(), decodedMsg.c_str());
}
else
{
printf("%-15s - %s\n", senderIp, decodedMsg.c_str());
printf("%-15s -> %-15s - %s\n", senderIp, recvIface.c_str(), decodedMsg.c_str());
}
}

Expand Down
9 changes: 6 additions & 3 deletions SenderModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,15 @@ void* SenderModule::runUcastReceiver()
while(numReady-- > 0)
{
int resultFd = -1;
std::string recvIfaceName = "default";

for (unsigned ii = 0 ; ii < mIfaces.size(); ++ii)
{
resultFd = mIfaces[ii].sockFd;
if (FD_ISSET(resultFd, &listenSet))
{
FD_CLR(resultFd, &listenSet);
recvIfaceName = mIfaces[ii].ifaceName;
break;
}
}
Expand Down Expand Up @@ -140,16 +143,16 @@ void* SenderModule::runUcastReceiver()
{
if (isIpV6())
{
printf("[ACK] %-45s (%s)\n", senderIp, decodedMsg.c_str());
printf("[ACK] %-45s -> %-10s (%s)\n", senderIp, recvIfaceName.c_str(), decodedMsg.c_str());
}
else
{
printf("[ACK] %-15s (%s)\n", senderIp, decodedMsg.c_str());
printf("[ACK] %-15s -> %-10s (%s)\n", senderIp, recvIfaceName.c_str(), decodedMsg.c_str());
}
}
else
{
cout << "Stray message: " << rxBuf << endl;
printf("[STRAY] %-15s -> %-10s (%s)\n", senderIp, recvIfaceName.c_str(), rxBuf);
}
}
}
Expand Down

0 comments on commit 2cc42ca

Please sign in to comment.