IPC: clean up the connection state checking

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>