Linkvalidation calling multiple times

linkvalidation calling multiple times.
How to restrict it to actual one?
myDiagram.toolManager.linkingTool.linkValidation = linkvalidation;

function linkvalidation(fromnode, fromport, tonode, toport) {

How to restrict to actual one only?

Which actual one? During the operation of the LinkingTool, for example, the proposed new link that the user is drawing may come close to many other ports, and those all need to be validated.

If a particular pair of ports being validated is not of interest to you, ignore it.