The problem is in calculating the distance between two arduino with HC-SR04.

Spurious reflections from the rather wide beam are no problem as it's only the first (presumably direct line) signal that matters. Any later signals are ignored.

It just means you have to allow for some time (10-100 ms) between pins for echoes to die out, or you may get triggered by an old one the moment you start listening again.