diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-02 20:44:59 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-02 20:44:59 -0600 |
commit | ff88c4cc9bfdc91c3af390ab6a7588f5a8ade40a (patch) | |
tree | ae18e6d4576fa594be94e8278877fbdedfa1d4ba /lib9p/srv.c | |
parent | 13b8cafb7e28784f037ecd24876c225ddcf48d76 (diff) | |
parent | 8cc87f8c1f25c9d3fec00561237891650a91b47a (diff) |
Merge branch 'lukeshu/9p-logging'
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) |