Distribute route path decision?

What about route path cost evaluation and shortest path decision?

For example, when hole punching fails, edge nodes A and B will connect through a relay. However, if at this time there is another edge node C on the edge side that can successfully perform hole punching with A and B, and the route path cost is lower than the relay connection, then the connection between A and B should be established through C.