make sure removing a connection from used does not fail

change the method from set.remove to set.discard, which
does not fail if the item to remove is not present.