Handling disconnect without exception