From ecbc800ce1787b0b899a08a88ca287a31a1a0076 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sun, 14 Feb 2010 21:07:13 +0000 Subject: [PATCH] * add missing debug statements for server I/O debugging * flush server read buffer before reading the next line --- webcit/tcp_sockets.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/webcit/tcp_sockets.c b/webcit/tcp_sockets.c index 23bdf7bea..0ad0e0618 100644 --- a/webcit/tcp_sockets.c +++ b/webcit/tcp_sockets.c @@ -153,7 +153,7 @@ int serv_getln(char *strbuf, int bufsize) FlushStrBuf(WCC->MigrateReadLineBuf); strbuf[len] = '\0'; #ifdef SERV_TRACE - lprintf(9, "%3d>%s\n", WC->serv_sock, strbuf); + lprintf(9, "%3d<<<%s\n", WC->serv_sock, strbuf); #endif return len; } @@ -164,7 +164,8 @@ int StrBuf_ServGetln(StrBuf *buf) wcsession *WCC = WC; const char *ErrStr = NULL; int rc; - + + FlushStrBuf(buf); rc = StrBufTCP_read_buffered_line_fast(buf, WCC->ReadBuf, &WCC->ReadPos, @@ -180,6 +181,15 @@ int StrBuf_ServGetln(StrBuf *buf) WCC->connected = 0; WCC->logged_in = 0; } +#ifdef SERV_TRACE + else + { + long pos=0; + if (WCC->ReadPos != NULL) + pos = WCC->ReadPos - ChrPtr(buf); + lprintf(9, "%3d<<<[%ld]%s\n", WC->serv_sock, pos, ChrPtr(buf)); + } +#endif return rc; } @@ -206,6 +216,11 @@ int StrBuf_ServGetBLOBBuffered(StrBuf *buf, long BlobSize) WCC->connected = 0; WCC->logged_in = 0; } +#ifdef SERV_TRACE + else + lprintf(9, "%3d<<serv_sock, StrLength(buf)); +#endif + return rc; } @@ -226,6 +241,11 @@ int StrBuf_ServGetBLOB(StrBuf *buf, long BlobSize) WCC->connected = 0; WCC->logged_in = 0; } +#ifdef SERV_TRACE + else + lprintf(9, "%3d<<serv_sock, StrLength(buf)); +#endif + return rc; } @@ -268,7 +288,7 @@ void serv_puts(const char *string) { wcsession *WCC = WC; #ifdef SERV_TRACE - lprintf(9, "%3d<%s\n", WC->serv_sock, string); + lprintf(9, "%3d>>>%s\n", WC->serv_sock, string); #endif FlushStrBuf(WCC->ReadBuf); WCC->ReadPos = NULL; @@ -285,7 +305,7 @@ void serv_putbuf(const StrBuf *string) { wcsession *WCC = WC; #ifdef SERV_TRACE - lprintf(9, "%3d<%s\n", WC->serv_sock, ChrPtr(string)); + lprintf(9, "%3d>>>%s\n", WC->serv_sock, ChrPtr(string)); #endif FlushStrBuf(WCC->ReadBuf); WCC->ReadPos = NULL; @@ -319,7 +339,7 @@ void serv_printf(const char *format,...) buf[len] = '\0'; serv_write(buf, len); #ifdef SERV_TRACE - lprintf(9, "<%s", buf); + lprintf(9, ">>>%s", buf); #endif } -- 2.30.2