Skip to content

Commit 0e23aaf

Browse files
committed
Further logging improvements.
1 parent 6bedc38 commit 0e23aaf

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

src/control.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,7 @@ bool handleNetPerfMeterControlMessage(MessageReader* messageReader,
11431143
else if(received < (ssize_t)sizeof(NetPerfMeterHeader)) {
11441144
if(received < 0) {
11451145
gOutputMutex.lock();
1146+
printTimeStamp(std::cerr);
11461147
std::cerr << "ERROR: Control connection is broken!\n";
11471148
gOutputMutex.unlock();
11481149
sendAbort(controlSocket, -1);
@@ -1165,6 +1166,7 @@ bool handleNetPerfMeterControlMessage(MessageReader* messageReader,
11651166
const NetPerfMeterHeader* header = (const NetPerfMeterHeader*)&inputBuffer;
11661167
if(ntohs(header->Length) != received) {
11671168
gOutputMutex.lock();
1169+
printTimeStamp(std::cerr);
11681170
std::cerr << "ERROR: Received malformed control message!\n"
11691171
<< " expected=" << ntohs(header->Length)
11701172
<< ", received="<< received << "\n";
@@ -1191,6 +1193,7 @@ bool handleNetPerfMeterControlMessage(MessageReader* messageReader,
11911193
(const NetPerfMeterStopMessage*)&inputBuffer, received));
11921194
default:
11931195
gOutputMutex.lock();
1196+
printTimeStamp(std::cerr);
11941197
std::cerr << "ERROR: Received invalid control message of type "
11951198
<< (unsigned int)header->Type << "!\n";
11961199
gOutputMutex.unlock();

src/flow.cc

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ bool Flow::configureSocket(const int socketDescriptor)
12811281
if (ext_setsockopt(socketDescriptor, IPPROTO_TCP, TCP_NODELAY, (const char*)&noDelayOption, sizeof(noDelayOption)) < 0) {
12821282
gOutputMutex.lock();
12831283
printTimeStamp(std::cerr);
1284-
std::cerr << "ERROR: Failed to set TCP_NODELAY - "
1284+
std::cerr << "ERROR: Failed to set TCP_NODELAY on socket " << socketDescriptor << " - "
12851285
<< strerror(errno) << "!\n";
12861286
gOutputMutex.unlock();
12871287
return(false);
@@ -1298,8 +1298,8 @@ bool Flow::configureSocket(const int socketDescriptor)
12981298
if (ext_setsockopt(socketDescriptor, IPPROTO_TCP, MPTCP_DEBUG, (const char*)&debugOption, sizeof(debugOption)) < 0) {
12991299
gOutputMutex.lock();
13001300
printTimeStamp(std::cerr);
1301-
std::cerr << "WARNING: Failed to set MPTCP_DEBUG on MPTCP socket - "
1302-
<< strerror(errno) << "!\n";
1301+
std::cerr << "WARNING: Failed to set MPTCP_DEBUG on MPTCP socket " << socketDescriptor << " - "
1302+
<< strerror(errno) << "!\n";
13031303
gOutputMutex.unlock();
13041304
}
13051305
}
@@ -1309,7 +1309,7 @@ bool Flow::configureSocket(const int socketDescriptor)
13091309
if (ext_setsockopt(socketDescriptor, IPPROTO_TCP, MPTCP_NDIFFPORTS, (const char*)&nDiffPorts, sizeof(nDiffPorts)) < 0) {
13101310
gOutputMutex.lock();
13111311
printTimeStamp(std::cerr);
1312-
std::cerr << "WARNING: Failed to set MPTCP_NDIFFPORTS on MPTCP socket - "
1312+
std::cerr << "WARNING: Failed to set MPTCP_NDIFFPORTS on MPTCP socket " << socketDescriptor << " - "
13131313
<< strerror(errno) << "!\n";
13141314
gOutputMutex.unlock();
13151315
}
@@ -1320,7 +1320,7 @@ bool Flow::configureSocket(const int socketDescriptor)
13201320
if (ext_setsockopt(socketDescriptor, IPPROTO_TCP, MPTCP_PATH_MANAGER, pathMgr, strlen(pathMgr)) < 0) {
13211321
gOutputMutex.lock();
13221322
printTimeStamp(std::cerr);
1323-
std::cerr << "WARNING: Failed to set MPTCP_PATH_MANAGER on MPTCP socket - "
1323+
std::cerr << "WARNING: Failed to set MPTCP_PATH_MANAGER on MPTCP socket " << socketDescriptor << " - "
13241324
<< strerror(errno) << "!\n";
13251325
gOutputMutex.unlock();
13261326
}
@@ -1331,7 +1331,7 @@ bool Flow::configureSocket(const int socketDescriptor)
13311331
if (ext_setsockopt(socketDescriptor, IPPROTO_TCP, MPTCP_SCHEDULER, scheduler, strlen(scheduler)) < 0) {
13321332
gOutputMutex.lock();
13331333
printTimeStamp(std::cerr);
1334-
std::cerr << "WARNING: Failed to set MPTCP_SCHEDULER on MPTCP socket - "
1334+
std::cerr << "WARNING: Failed to set MPTCP_SCHEDULER on MPTCP socket " << socketDescriptor << " - "
13351335
<< strerror(errno) << "!\n";
13361336
gOutputMutex.unlock();
13371337
}
@@ -1345,8 +1345,9 @@ bool Flow::configureSocket(const int socketDescriptor)
13451345
if(strcmp(congestionControl, "default") != 0) {
13461346
if (ext_setsockopt(socketDescriptor, IPPROTO_TCP, TCP_CONGESTION, congestionControl, strlen(congestionControl)) < 0) {
13471347
gOutputMutex.lock();
1348+
printTimeStamp(std::cerr);
13481349
std::cerr << "ERROR: Failed to set TCP_CONGESTION ("
1349-
<< congestionControl << ") - "
1350+
<< congestionControl << ") on socket " << socketDescriptor << " - "
13501351
<< strerror(errno) << "!\n";
13511352
gOutputMutex.unlock();
13521353
return(false);
@@ -1360,7 +1361,7 @@ bool Flow::configureSocket(const int socketDescriptor)
13601361
if (ext_setsockopt(socketDescriptor, IPPROTO_SCTP, SCTP_NODELAY, (const char*)&noDelayOption, sizeof(noDelayOption)) < 0) {
13611362
gOutputMutex.lock();
13621363
printTimeStamp(std::cerr);
1363-
std::cerr << "ERROR: Failed to set SCTP_NODELAY on SCTP socket - "
1364+
std::cerr << "ERROR: Failed to set SCTP_NODELAY on SCTP socket " << socketDescriptor << " - "
13641365
<< strerror(errno) << "!\n";
13651366
gOutputMutex.unlock();
13661367
return(false);
@@ -1374,7 +1375,7 @@ bool Flow::configureSocket(const int socketDescriptor)
13741375
if(TrafficSpec.CMT != NPAF_PRIMARY_PATH) {
13751376
gOutputMutex.lock();
13761377
printTimeStamp(std::cerr);
1377-
std::cerr << "ERROR: Failed to configure CMT usage on SCTP socket (SCTP_CMT_ON_OFF option) - "
1378+
std::cerr << "ERROR: Failed to configure CMT usage (SCTP_CMT_ON_OFF option) on SCTP socket " << socketDescriptor << " - "
13781379
<< strerror(errno) << "!\n";
13791380
gOutputMutex.unlock();
13801381
return(false);
@@ -1398,17 +1399,17 @@ bool Flow::configureSocket(const int socketDescriptor)
13981399
gOutputMutex.lock();
13991400
printTimeStamp(std::cerr);
14001401
std::cerr << "WARNING: Failed to configure CCID #" << (unsigned int)value
1401-
<< " on DCCP socket (DCCP_SOCKOPT_CCID option) - "
1402-
<< strerror(errno) << "!\n";
1402+
<< " (DCCP_SOCKOPT_CCID option) on DCCP socket - "
1403+
<< socketDescriptor << " - " << strerror(errno) << "!\n";
14031404
gOutputMutex.unlock();
14041405
}
14051406
}
14061407
const uint32_t service[1] = { htonl(SC_NETPERFMETER_DATA) };
14071408
if(ext_setsockopt(socketDescriptor, SOL_DCCP, DCCP_SOCKOPT_SERVICE, &service, sizeof(service)) < 0) {
14081409
gOutputMutex.lock();
14091410
printTimeStamp(std::cerr);
1410-
std::cerr << "ERROR: Failed to configure DCCP service code on DCCP socket (DCCP_SOCKOPT_SERVICE option) - "
1411-
<< strerror(errno) << "!\n";
1411+
std::cerr << "ERROR: Failed to configure DCCP service code (DCCP_SOCKOPT_SERVICE option) on DCCP socket "
1412+
<< socketDescriptor << " - " << strerror(errno) << "!\n";
14121413
gOutputMutex.unlock();
14131414
return(false);
14141415
}

0 commit comments

Comments
 (0)