A nearby port (as determined by the distance between dc and the result of PortPoint) must be within the GoView.PortGravity distance for it to qualify, and it must be in a GoLayer that is visible. This uses the IsValidLink predicate, passing it the OriginalStartPort along with each port to be considered. The results of IsValidLink are cached in ValidPortsCache, for the cases where determining valid links is computationally expensive. This cache is valid only for the duration of this linking tool as the current tool; it is cleared each time this tool is stopped.