Improve peering protocol: now correctly handles peering events