diff options
Diffstat (limited to 'lib9p/srv.c')
-rw-r--r-- | lib9p/srv.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib9p/srv.c b/lib9p/srv.c index 2723207..bfeb06f 100644 --- a/lib9p/srv.c +++ b/lib9p/srv.c @@ -199,6 +199,7 @@ static void respond_error(struct _lib9p_srv_req *req) { LIB9P_TYP_Rerror, &host, &net); + infof("< %v", lo_box_lib9p_msg_Rerror_as_fmt_formatter(&host)); r = write_Rmsg(req, &net); if (r < 0) nonrespond_errorf("write: %s", net_strerror(-r)); @@ -419,11 +420,12 @@ static void handle_message(struct _lib9p_srv_req *ctx) { ssize_t host_size = lib9p_Tmsg_validate(&ctx->ctx.basectx, ctx->net_bytes); if (host_size < 0) goto write; - host_req = malloc(host_size); + host_req = calloc(1, host_size); assert(host_req); enum lib9p_msg_type typ; lib9p_Tmsg_unmarshal(&ctx->ctx.basectx, ctx->net_bytes, &typ, host_req); + infof("> %v", lo_box_lib9p_msg_as_fmt_formatter(&ctx->ctx.basectx, typ, host_req)); /* Handle it. */ tmessage_handlers[typ](ctx, (void *)host_req, (void *)host_resp); @@ -437,6 +439,7 @@ static void handle_message(struct _lib9p_srv_req *ctx) { typ+1, host_resp, &net_resp)) goto write; + infof("< %v", lo_box_lib9p_msg_as_fmt_formatter(&ctx->ctx.basectx, typ+1, &host_resp)); write_Rmsg(ctx, &net_resp); } if (host_req) |