Implementation of the Bully Algorithm to elect a master among equal peers in a distributed system