 	public func disconnected(connection: WebSocketConnection, reason: WebSocketCloseReasonCode) {
 		Log.info("[Server] disconnected gossip \(connection.id); reason=\(reason)")
 		self.mutex.locked {
-			self.gossipConnections.removeValue(forKey: connection.id)
+			if let pic = self.gossipConnections[connection.id] {
+				pic.disconnected()
+				self.gossipConnections.removeValue(forKey: connection.id)
+			}
 		}
 	}
 

		if !self.connection.isConnected {
			self.connection.connect()
		}
	}

	deinit {
		self.delegate?.peer(disconnected: self)
	}

	public override func send(data: Data) throws {

		self.connection.close()
	}

	/** Called by the Server class when the WebSocket connection is disconnected. */
	fileprivate func disconnected() {
		self.delegate?.peer(disconnected: self)
	}

	func close() {
		self.connection.close()
	}
