improved logging

This commit is contained in:
mpc
2004-11-19 02:17:20 +00:00
committed by zzz
parent ed8eced9dd
commit c8f6d9c7a1
2 changed files with 16 additions and 5 deletions

View File

@@ -1,9 +1,10 @@
/* vi:set ts=4: */
v1.30
* Added SAM_BAD_STYLE error
* Improved WIRETAP to do more logging
* Added "pinger.sh" shell script example for using i2p-ping
* Various minor enhancements and bug fixes
* Added SAM_BAD_STYLE error
* Added exit values for i2p-ping from xolo
v1.25 2004-07-31
* Created I2P-Ping, a new example program (it's a clone of I2Ping). Works

View File

@@ -598,7 +598,7 @@ static ssize_t sam_read1(sam_sess_t *session, char *buf, size_t n)
if (*p == '\n') { /* end of SAM response */
*p = '\0';
#if SAM_WIRETAP
printf("<<<< %s\n", buf);
printf("*RR* %s\n", buf);
#endif
return n - nleft;
}
@@ -663,7 +663,16 @@ static ssize_t sam_read2(sam_sess_t *session, void *buf, size_t n)
p += nread;
}
#if SAM_WIRETAP
printf("<<<< (read2() %d bytes)\n", n);
p = buf;
printf("*RR* ");
for (size_t x = 0; x < n; x++) {
if (isprint(((uchar_t*)p)[x]))
printf("%c,", ((uchar_t*)p)[x]);
else
printf("%03d,", ((uint8_t*)p)[x]);
}
printf("\n");
printf("*RR* (read2() read %d bytes)\n", n);
#endif
assert(nleft == 0);/* <---\ */
return n - nleft; /* should be equal to initial n */
@@ -1334,6 +1343,7 @@ static ssize_t sam_write(sam_sess_t *session, const void *buf, size_t n)
}
#if SAM_WIRETAP
const uchar_t *cp = buf;
printf("*WW* ");
for (size_t x = 0; x < n; x++) {
if (isprint(cp[x]))
printf("%c,", cp[x]);
@@ -1365,7 +1375,7 @@ static ssize_t sam_write(sam_sess_t *session, const void *buf, size_t n)
p += nwritten;
}
#if SAM_WIRETAP
printf(">>>> (write() %d bytes)\n", n);
printf("*WW* (write() wrote %d bytes)\n", n);
#endif
return n;