Replaces all prints with atomic module_logging debug_printf
Search through all connected listeners before incrementing count.

Bug 15151 caused the connection_count to be erroneously incremented when attempting to connect to the same device. Thus the stream was not switched into DISABLED when connection_count == 0.