The ivshmem client/server protocol is one-way: only the server sends. The only way clients can communicate is by connect and close.
Since the ivshmem device model uses a chardev for its connection to the server, both connect and close happen in chardev code. Example: monitor command chardev-add connects, the server starts sending. chardev-add succeeds. device_add fails somehow. Now you must chardev-remove to close the connection. >From the server's point of view, a peer connected and disconnected. It duly announces this to already connected peers. This is a bit weird, but it shouldn't cause problems. If you forget to chardev-remove, the "peer" stays connected. Can be declared PEBKAC. Connect on realize and close on realize failure and unrealize would be neater, I think. Chardevs don't let me do that, as far as I can tell. Ideas? There's one exception to the behavior I just described: on version mismatch, the device model calls qemu_chr_delete(). I consider that a bug, and I'm going to fix it.