Commit f5e11e8e authored by Lubomir Bulej's avatar Lubomir Bulej

disl-agent: avoid name clash on dprintf().

parent 3a83cf90
...@@ -51,22 +51,15 @@ ...@@ -51,22 +51,15 @@
* *
*/ */
#ifdef NDEBUG #ifdef NDEBUG
# define dprintf(args...) do {} while (0) # define debug(args...) do {} while (0)
#else #else
# define dprintf(args...) fprintf (stdout, args); fflush (stdout) # define debug(args...) fprintf (stdout, args); fflush (stdout)
#endif #endif
#define dlprintf(args...) { \ #define ldebug(args...) { \
dprintf ("%s:%d: ", __FUNCTION__, __LINE__); \ debug ("%s:%d: ", __FUNCTION__, __LINE__); \
dprintf (args); \ debug (args); \
}
#define dlwrap(code) { \
dlprintf (""); \
code; \
dprintf ("\n"); \
} }
// //
......
...@@ -73,7 +73,7 @@ void ...@@ -73,7 +73,7 @@ void
connection_close (struct connection * connection) { connection_close (struct connection * connection) {
assert (connection != NULL); assert (connection != NULL);
dprintf ( debug (
"socket %d: sent bytes %" PRIu64 ", recv bytes %" PRIu64 "\n", "socket %d: sent bytes %" PRIu64 ", recv bytes %" PRIu64 "\n",
connection->sockfd, connection->sent_bytes, connection->recv_bytes connection->sockfd, connection->sent_bytes, connection->recv_bytes
); );
......
...@@ -59,14 +59,14 @@ struct connection * ...@@ -59,14 +59,14 @@ struct connection *
connection_pool_get_connection (struct connection_pool * cp) { connection_pool_get_connection (struct connection_pool * cp) {
assert (cp != NULL); assert (cp != NULL);
dlprintf ("getting connection for %s: ", cp->endpoint->ai_canonname); ldebug ("getting connection for %s: ", cp->endpoint->ai_canonname);
// //
// Grab the first available connection and return. If there is no connection // Grab the first available connection and return. If there is no connection
// available, create a new one and add it to the busy connection list. // available, create a new one and add it to the busy connection list.
// //
if (!list_is_empty (&cp->free_connections)) { if (!list_is_empty (&cp->free_connections)) {
dprintf ("reusing a connection [%d in total]\n", cp->connections_count); debug ("reusing a connection [%d in total]\n", cp->connections_count);
struct list * item = list_remove_after (&cp->free_connections); struct list * item = list_remove_after (&cp->free_connections);
list_insert_after (item, &cp->busy_connections); list_insert_after (item, &cp->busy_connections);
return list_item (item, struct connection, cp_link); return list_item (item, struct connection, cp_link);
...@@ -80,7 +80,7 @@ connection_pool_get_connection (struct connection_pool * cp) { ...@@ -80,7 +80,7 @@ connection_pool_get_connection (struct connection_pool * cp) {
list_insert_after (&connection->cp_link, &cp->busy_connections); list_insert_after (&connection->cp_link, &cp->busy_connections);
cp->connections_count++; cp->connections_count++;
dprintf ("created new connection [%d in total]\n", cp->connections_count); debug ("created new connection [%d in total]\n", cp->connections_count);
return connection; return connection;
} }
} }
...@@ -129,7 +129,7 @@ void ...@@ -129,7 +129,7 @@ void
connection_pool_close (struct connection_pool * cp) { connection_pool_close (struct connection_pool * cp) {
assert (cp != NULL); assert (cp != NULL);
dlprintf ( ldebug (
"closing pool for %s: max connections %d\n", "closing pool for %s: max connections %d\n",
cp->endpoint->ai_canonname, cp->connections_count cp->endpoint->ai_canonname, cp->connections_count
); );
......
...@@ -67,7 +67,7 @@ message_send (struct connection * conn, struct message * msg) { ...@@ -67,7 +67,7 @@ message_send (struct connection * conn, struct message * msg) {
assert (conn != NULL); assert (conn != NULL);
assert (msg != NULL); assert (msg != NULL);
dlprintf ( ldebug (
"sending message: flags %08x, control %d, code %d ... ", "sending message: flags %08x, control %d, code %d ... ",
msg->message_flags, msg->control_size, msg->classcode_size msg->message_flags, msg->control_size, msg->classcode_size
); );
...@@ -85,7 +85,7 @@ message_send (struct connection * conn, struct message * msg) { ...@@ -85,7 +85,7 @@ message_send (struct connection * conn, struct message * msg) {
// //
dprintf ("sent %ld bytes ... done\n", sent); debug ("sent %ld bytes ... done\n", sent);
return sent; return sent;
} }
...@@ -119,7 +119,7 @@ message_recv (struct connection * conn, struct message * msg) { ...@@ -119,7 +119,7 @@ message_recv (struct connection * conn, struct message * msg) {
assert (conn != NULL); assert (conn != NULL);
assert (msg != NULL); assert (msg != NULL);
dlprintf ("receiving message: "); ldebug ("receiving message: ");
// //
// First, receive the flags, the control and class code sizes. // First, receive the flags, the control and class code sizes.
...@@ -151,7 +151,7 @@ message_recv (struct connection * conn, struct message * msg) { ...@@ -151,7 +151,7 @@ message_recv (struct connection * conn, struct message * msg) {
// //
dprintf ( debug (
"flags %08x, control %d, code %d ... done\n", "flags %08x, control %d, code %d ... done\n",
response_flags, control_size, classcode_size response_flags, control_size, classcode_size
); );
......
...@@ -114,7 +114,7 @@ network_fini () { ...@@ -114,7 +114,7 @@ network_fini () {
struct connection * struct connection *
network_acquire_connection () { network_acquire_connection () {
dlprintf ("acquiring connection ... "); ldebug ("acquiring connection ... ");
// //
// The connection pool must be protected by a lock so that multiple threads // The connection pool must be protected by a lock so that multiple threads
...@@ -129,7 +129,7 @@ network_acquire_connection () { ...@@ -129,7 +129,7 @@ network_acquire_connection () {
// //
dprintf ("done\n"); debug ("done\n");
return connection; return connection;
} }
...@@ -140,7 +140,7 @@ network_acquire_connection () { ...@@ -140,7 +140,7 @@ network_acquire_connection () {
void void
network_release_connection (struct connection * connection) { network_release_connection (struct connection * connection) {
assert (connection != NULL); assert (connection != NULL);
dlprintf ("releasing connection ... "); ldebug ("releasing connection ... ");
// //
// The connection pool must be protected by a lock so that multiple threads // The connection pool must be protected by a lock so that multiple threads
...@@ -154,5 +154,5 @@ network_release_connection (struct connection * connection) { ...@@ -154,5 +154,5 @@ network_release_connection (struct connection * connection) {
// //
dprintf ("done\n"); debug ("done\n");
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment