summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b35f891)
Change all #define's to follow the form
#define DEBUG_xxx {0|1}
to disable (0, default) or enable (1) additional debug messages.
And somewhat enhance some DEBUG_BUFFER messages.
* Functions to dynamically allocate arrays.
*/
* Functions to dynamically allocate arrays.
*/
+/* Additionan debug messages related to array handling: 0=off / 1=on */
+#define DEBUG_ARRAY 0
+
#include "array.h"
#include <assert.h>
#include "array.h"
#include <assert.h>
#include <string.h>
#include <unistd.h>
#include <string.h>
#include <unistd.h>
-/* Enable more Debug messages in alloc / append / memmove code. */
-/* #define DEBUG_ARRAY */
-
#define array_UNUSABLE(x) ( !(x)->mem )
#define array_UNUSABLE(x) ( !(x)->mem )
return NULL;
if (a->allocated < alloc) {
return NULL;
if (a->allocated < alloc) {
Log(LOG_DEBUG, "array_alloc(): changing size from %u to %u bytes.",
a->allocated, alloc);
#endif
Log(LOG_DEBUG, "array_alloc(): changing size from %u to %u bytes.",
a->allocated, alloc);
#endif
Log(LOG_DEBUG,
"array_catb(): appending %u bytes to array (now %u bytes in array).",
len, tmp);
Log(LOG_DEBUG,
"array_catb(): appending %u bytes to array (now %u bytes in array).",
len, tmp);
array_free(array * a)
{
assert(a != NULL);
array_free(array * a)
{
assert(a != NULL);
Log(LOG_DEBUG,
"array_free(): %u bytes free'd (%u bytes still used at time of free()).",
a->allocated, a->used);
Log(LOG_DEBUG,
"array_free(): %u bytes free'd (%u bytes still used at time of free()).",
a->allocated, a->used);
if (!bytepos)
return; /* nothing to do */
if (!bytepos)
return; /* nothing to do */
Log(LOG_DEBUG,
"array_moveleft(): %u bytes used in array, starting at position %u.",
a->used, bytepos);
Log(LOG_DEBUG,
"array_moveleft(): %u bytes used in array, starting at position %u.",
a->used, bytepos);
* Please read the file COPYING, README and AUTHORS for more information.
*/
* Please read the file COPYING, README and AUTHORS for more information.
*/
* Connection compression using ZLIB
*/
* Connection compression using ZLIB
*/
+/* Additionan debug messages related to ZIP compression: 0=off / 1=on */
+#define DEBUG_ZIP 0
-/* enable more zlib related debug messages: */
-/* #define DEBUG_ZLIB */
-
#include <assert.h>
#include <string.h>
#include <zlib.h>
#include <assert.h>
#include <string.h>
#include <zlib.h>
out->next_out = zipbuf;
out->avail_out = (uInt)sizeof zipbuf;
out->next_out = zipbuf;
out->avail_out = (uInt)sizeof zipbuf;
Log(LOG_DEBUG, "out->avail_in %d, out->avail_out %d",
out->avail_in, out->avail_out);
#endif
Log(LOG_DEBUG, "out->avail_in %d, out->avail_out %d",
out->avail_in, out->avail_out);
#endif
assert(out->avail_out <= WRITEBUFFER_SLINK_LEN);
zipbuf_used = WRITEBUFFER_SLINK_LEN - out->avail_out;
assert(out->avail_out <= WRITEBUFFER_SLINK_LEN);
zipbuf_used = WRITEBUFFER_SLINK_LEN - out->avail_out;
Log(LOG_DEBUG, "zipbuf_used: %d", zipbuf_used);
#endif
if (!array_catb(&My_Connections[Idx].wbuf,
Log(LOG_DEBUG, "zipbuf_used: %d", zipbuf_used);
#endif
if (!array_catb(&My_Connections[Idx].wbuf,
in->next_out = unzipbuf;
in->avail_out = (uInt)sizeof unzipbuf;
in->next_out = unzipbuf;
in->avail_out = (uInt)sizeof unzipbuf;
Log(LOG_DEBUG, "in->avail_in %d, in->avail_out %d",
in->avail_in, in->avail_out);
#endif
Log(LOG_DEBUG, "in->avail_in %d, in->avail_out %d",
in->avail_in, in->avail_out);
#endif
assert(z_rdatalen >= in->avail_in);
in_len = z_rdatalen - in->avail_in;
unzipbuf_used = READBUFFER_LEN - in->avail_out;
assert(z_rdatalen >= in->avail_in);
in_len = z_rdatalen - in->avail_in;
unzipbuf_used = READBUFFER_LEN - in->avail_out;
Log(LOG_DEBUG, "unzipbuf_used: %d - %d = %d", READBUFFER_LEN,
in->avail_out, unzipbuf_used);
#endif
Log(LOG_DEBUG, "unzipbuf_used: %d - %d = %d", READBUFFER_LEN,
in->avail_out, unzipbuf_used);
#endif
* Please read the file COPYING, README and AUTHORS for more information.
*/
* Please read the file COPYING, README and AUTHORS for more information.
*/
#define CONN_MODULE
#include "portab.h"
#define CONN_MODULE
#include "portab.h"
* Connection management
*/
* Connection management
*/
+/* Additionan debug messages related to buffer handling: 0=off / 1=on */
+#define DEBUG_BUFFER 0
+
#include <assert.h>
#ifdef PROTOTYPES
# include <stdarg.h>
#include <assert.h>
#ifdef PROTOTYPES
# include <stdarg.h>
LogDebug
("Handle_Write() called for connection %d, %ld bytes pending ...",
Idx, wdatalen);
LogDebug
("Handle_Write() called for connection %d, %ld bytes pending ...",
Idx, wdatalen);
return 0; /* error -> connection has been closed */
array_moveleft(&My_Connections[Idx].rbuf, 1, len);
return 0; /* error -> connection has been closed */
array_moveleft(&My_Connections[Idx].rbuf, 1, len);
-#ifdef DEBUG_BUFFER
- LogDebug("Connection %d: %d bytes left in read buffer.",
- Idx, array_bytes(&My_Connections[Idx].rbuf));
-#endif
#ifdef ZLIB
if ((!old_z) && (My_Connections[Idx].options & CONN_ZIP) &&
(array_bytes(&My_Connections[Idx].rbuf) > 0)) {
#ifdef ZLIB
if ((!old_z) && (My_Connections[Idx].options & CONN_ZIP) &&
(array_bytes(&My_Connections[Idx].rbuf) > 0)) {
+#if DEBUG_BUFFER
+ LogDebug("Connection %d: Processed %ld commands (max=%ld), %ld bytes. %ld bytes left in read buffer.",
+ Idx, i, maxcmd, len_processed,
+ array_bytes(&My_Connections[Idx].rbuf));
+#endif
+
return len_processed;
} /* Handle_Buffer */
return len_processed;
} /* Handle_Buffer */
* I/O abstraction interface.
*/
* I/O abstraction interface.
*/
+/* Extra debug messages in event add/delete/callback code: 0=off / 1=on */
+#define DEBUG_IO 0
+
#include <assert.h>
#include <string.h>
#include <sys/types.h>
#include <assert.h>
#include <string.h>
#include <sys/types.h>
#include "io.h"
#include "log.h"
#include "io.h"
#include "log.h"
-/* Enables extra debug messages in event add/delete/callback code. */
-/* #define DEBUG_IO */
-
typedef struct {
#ifdef PROTOTYPES
void (*callback)(int, short);
typedef struct {
#ifdef PROTOTYPES
void (*callback)(int, short);
static void io_docallback PARAMS((int fd, short what));
static void io_docallback PARAMS((int fd, short what));
static void
io_debug(const char *s, int fd, int what)
{
static void
io_debug(const char *s, int fd, int what)
{