The broadcast nature of xPL means that xPL messages are confined to a single subnet. In order to join two subnets, a bridge is run on a host on each subnet. Each bridge is an xPL client that joins the hub on its local subnet.
In addition to typical client behaviour, a bridge should transmit all messages received from the local hub to the remote bridge. The remote bridge will then broadcast the message to its local subnet.
The remote bridge will then receive the message back from its local hub and, if it was to transmit the message to the opposite end of the bridge, a loop would be created. It is therefore necessary for a bridge to block these duplicate messages and not send them back again.
In order to simplify coding, incoming xPL messages are processed using a message digest algorithm, such as MD5 or SHA1, to create a hash to represent each message. One approach to loop prevention is to use a lookup table using the hashes as keys, with a list of timestamps stored against each key. When a message is received from a remote bridge, the current time is added to the list in the table against the hash of the message. When a message is received from the local hub, its hash is looked up and if the list in empty it is transmitted to the remote bridge. If the list is not empty, then the oldest timestamp is removed and the message is not transmitted.
The table should be pruned periodically to remove old timestamps. Any timestamp more than a second or two old is almost certainly not required for loop detection.