Add an helper function to check whether the connection is active