summaryrefslogtreecommitdiffstats
path: root/src/printf.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-03-01 06:42:05 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-03-01 06:42:05 +0100
commit68bb9f39967ca45166bd070ee1f3fa1304cb6e98 (patch)
treea3d57ca1bb2c5e5fc54a784ee1239f1b1167b0d8 /src/printf.c
parente5415f2b024119a8f32879db10976336d56ae1bc (diff)
downloadfastd-68bb9f39967ca45166bd070ee1f3fa1304cb6e98.tar
fastd-68bb9f39967ca45166bd070ee1f3fa1304cb6e98.zip
Identify peers be key in log output when no name is available
Diffstat (limited to 'src/printf.c')
-rw-r--r--src/printf.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/printf.c b/src/printf.c
index e55ae20..bd06727 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -67,10 +67,16 @@ static int snprint_peer_address(const fastd_context_t *ctx, char *buffer, size_t
}
static int snprint_peer_str(const fastd_context_t *ctx, char *buffer, size_t size, const fastd_peer_t *peer) {
- if (peer->config && peer->config->name)
+ if (peer->config && peer->config->name) {
return snprintf_safe(buffer, size, "<%s>", peer->config->name);
- else
- return snprintf_safe(buffer, size, "<(null)>");
+ }
+ else {
+ char buf[65];
+ if (ctx->conf->protocol->describe_peer(ctx, peer, buf, sizeof(buf)))
+ return snprintf_safe(buffer, size, "{%s}", buf);
+ else
+ return snprintf_safe(buffer, size, "(null)");
+ }
}
int fastd_vsnprintf(const fastd_context_t *ctx, char *buffer, size_t size, const char *format, va_list ap) {