Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r706 committed - Fixing bug that caused unnecessary characters in protocol payload to b...

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r706 committed - Fixing bug that caused unnecessary characters in protocol payload to b...


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r706 committed - Fixing bug that caused unnecessary characters in protocol payload to b...
  • Date: Tue, 11 Oct 2011 02:20:45 +0000

Revision: 706
Author:

Date: Mon Oct 10 19:19:48 2011
Log: Fixing bug that caused unnecessary characters in protocol payload to be printed. These were caused by a buffer pointer used per test - hence the extra characters at the end. Fixed by using only 'len' number of chars. commenting out some test variables too
http://code.google.com/p/ndt/source/detail?r=706

Modified:
/branches/kkumar_code_organize/src/logging.c

=======================================
--- /branches/kkumar_code_organize/src/logging.c Sun Oct 9 17:00:18
2011
+++ /branches/kkumar_code_organize/src/logging.c Mon Oct 10 19:19:48
2011
@@ -33,7 +33,6 @@
static char* ProtocolLogDirName = BASEDIR"/"LOGDIR;
static char protocollogfilestore[256];
static char enableprotologging = 0;
-static const char* abc = "/var/log/ndt//web100srvprotocol_207.75.164.174.log";
static I2ErrHandle _errorhandler_nl = NULL;
static I2ErrHandle _errorhandler = NULL;
static I2LogImmediateAttr _immediateattr_nl;
@@ -214,7 +213,7 @@
// Protocol log location being set
if (dirname == NULL) {
//use default of BASEDIR/LOGDIR
- printf ("PV: 1: NULL proto location =%s;\n",
ProtocolLogDirName);
+ // printf ("PV: 1: NULL proto location =%s;\n",
ProtocolLogDirName);
log_println (0, "PV: 1: NULL proto location =%s;\n",
ProtocolLogDirName);
return;
}
@@ -257,10 +256,8 @@
}
sprintf(protologlocalarr, "%s/%s%s%s%s", ProtocolLogDirName, PROTOLOGPREFIX , client_ip,
PROTOLOGSUFFIX,"\0");
- PROTOLOGSUFFIX);
strncpy(ProtocolLogFileName, protologlocalarr,
strnlen(protologlocalarr));

-
//log_println (0, "***SET %s: %s;****\n", ProtocolLogFileName, ProtocolLogDirName);

/* debug block
@@ -303,9 +300,8 @@
char*
get_protologfile()
{
- //return ProtocolLogFileName;
- log_println (0, "**ProtoLog = %s ", ProtocolLogFileName);
- return abc;
+ //log_println (0, "**ProtoLog = %s ", ProtocolLogFileName);
+ return ProtocolLogFileName;
}

/**
@@ -414,7 +410,7 @@
return;
}

- // // make delimiters in message payload explicit
+ // make delimiters in message payload explicit
quote_delimiters(value, strlen(value), logmessage,
sizeof(logmessage));

fp = fopen(get_protologfile(),"a");
@@ -558,14 +554,14 @@
char msgtypedescarr[MSG_TYPE_DESC_SIZE];
char *currenttestname, *currentmsgtype;
char isotime[64];
- char logmessage[4096]; // message after replacing unnecessary
characters
+ char logmessage[4096]; // message after replacing delimiter characters

// get descriptive strings for test name and direction
currenttestname = get_currenttestdesc();
currentmsgtype = get_msgtypedesc(type,msgtypedescarr);

// make delimiters in message payload explicit
- quote_delimiters(msg, strlen(msg), logmessage, sizeof(logmessage));
+ quote_delimiters(msg, len, logmessage, sizeof(logmessage));

fp = fopen(get_protologfile(),"a");
if (fp == NULL) {
@@ -597,11 +593,13 @@
* */
//void protolog_sendprintln (int lvl, const int type, void* msg, const int len, const int processid, const int ctlSocket) {
void protolog_sendprintln (const int type, void* msg, const int len, const int processid, const int ctlSocket) {
+ char *currentDir;
+
if (!enableprotologging) {
log_println(0, "Protocol logging is not enabled");
- return;
- }
- char *currentDir = get_currentdirndesc();
+ return;
+ }
+ currentDir = get_currentdirndesc();
//protolog_println(lvl, currentDir, type, msg, len, processid,
ctlSocket);
protolog_println(currentDir, type, msg, len, processid, ctlSocket);
}
@@ -617,11 +615,12 @@
* @param ctlSocket socket over which message has been exchanged
* */
void protolog_rcvprintln (const int type, void* msg, const int len, const int processid, const int ctlSocket){
+ char *otherDir;
if (!enableprotologging) {
log_println(0, "Protocol logging is not enabled");
return;
}
- char *otherDir = get_otherdirndesc();
+ otherDir = get_otherdirndesc();
//protolog_println(lvl, otherDir, type, msg, len, processid,
ctlSocket);
protolog_println(otherDir, type, msg, len, processid, ctlSocket);
}


  • [ndt-dev] [ndt] r706 committed - Fixing bug that caused unnecessary characters in protocol payload to b..., ndt, 10/10/2011

Archive powered by MHonArc 2.6.16.

Top of Page