public override void HandleMessage(ZeroPacket message) { int size = message.Content.ReadableBytes; switch (message.PacketType) { case SnapMessageCode.GetAccountRange: GetAccountRangeMessage getAccountRangeMessage = Deserialize <GetAccountRangeMessage>(message.Content); ReportIn(getAccountRangeMessage); Handle(getAccountRangeMessage); break; case SnapMessageCode.AccountRange: AccountRangeMessage accountRangeMessage = Deserialize <AccountRangeMessage>(message.Content); ReportIn(accountRangeMessage); Handle(accountRangeMessage, size); break; case SnapMessageCode.GetStorageRanges: GetStorageRangeMessage getStorageRangesMessage = Deserialize <GetStorageRangeMessage>(message.Content); ReportIn(getStorageRangesMessage); Handle(getStorageRangesMessage); break; case SnapMessageCode.StorageRanges: StorageRangeMessage storageRangesMessage = Deserialize <StorageRangeMessage>(message.Content); ReportIn(storageRangesMessage); Handle(storageRangesMessage, size); break; case SnapMessageCode.GetByteCodes: GetByteCodesMessage getByteCodesMessage = Deserialize <GetByteCodesMessage>(message.Content); ReportIn(getByteCodesMessage); Handle(getByteCodesMessage); break; case SnapMessageCode.ByteCodes: ByteCodesMessage byteCodesMessage = Deserialize <ByteCodesMessage>(message.Content); ReportIn(byteCodesMessage); Handle(byteCodesMessage, size); break; case SnapMessageCode.GetTrieNodes: GetTrieNodesMessage getTrieNodesMessage = Deserialize <GetTrieNodesMessage>(message.Content); ReportIn(getTrieNodesMessage); Handle(getTrieNodesMessage); break; case SnapMessageCode.TrieNodes: TrieNodesMessage trieNodesMessage = Deserialize <TrieNodesMessage>(message.Content); ReportIn(trieNodesMessage); Handle(trieNodesMessage, size); break; } }
public async Task <byte[][]> GetByteCodes(Keccak[] codeHashes, CancellationToken token) { var request = new GetByteCodesMessage() { Hashes = codeHashes, Bytes = BYTES_LIMIT }; ByteCodesMessage response = await SendRequest(request, _getByteCodesRequests, token); Metrics.SnapGetByteCodesSent++; return(response.Codes); }
private void Handle(ByteCodesMessage msg, long size) { Metrics.SnapByteCodesReceived++; _getByteCodesRequests.Handle(msg, size); }