Haskell version of peering1.c
Partial implementation of second section of peering broker