> Why not simply make a new sub where the socket is not closed instantly but > instead is closed on demand or add an option to the existing sub which, if true, > requires manual closing of the socket? Because qmp only allows one connection, so that would block any other command.