---
nbd/server.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/nbd/server.c b/nbd/server.c
index 82a78bf439..d6fbd46370 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -919,6 +919,17 @@ static int nbd_send_reply(QIOChannel *ioc, NBDReply
*reply, Error **errp)
stl_be_p(buf + 4, reply->error);
stq_be_p(buf + 8, reply->handle);
+ static int debug;
+ static int count;
+ if (!count++) {
+ const char *str = getenv("NBD_SERVER_DEBUG");
+ if (str) {
+ debug = atoi(str);
+ }
+ }
+ if (debug && !(count % debug)) {
+ buf[0] = 0;
+ }
return nbd_write(ioc, buf, sizeof(buf), errp);
}
--
2.13.4