public static void skipChecksumIfPresent(ByteBuf buffer) { if (hasChecksum(buffer)) { readChecksum(buffer); } }
public static boolean verifyChecksum(TopicName topic, ByteBuf headersAndPayload, long ledgerId, long entryId) { if (hasChecksum(headersAndPayload)) { int checksum = readChecksum(headersAndPayload); int computedChecksum = computeChecksum(headersAndPayload); if (checksum != computedChecksum) { log.error( "[{}] Checksum mismatch for message at {}:{}. Received checksum: 0x{}, Computed checksum: 0x{}", topic, ledgerId, entryId, Long.toHexString(checksum), Integer.toHexString(computedChecksum)); return false; } } return true; }
private boolean verifyChecksum(ByteBuf headersAndPayload, MessageIdData messageId) { if (hasChecksum(headersAndPayload)) { int checksum = readChecksum(headersAndPayload); int computedChecksum = computeChecksum(headersAndPayload); if (checksum != computedChecksum) { log.error( "[{}][{}] Checksum mismatch for message at {}:{}. Received checksum: 0x{}, Computed checksum: 0x{}", topic, subscription, messageId.getLedgerId(), messageId.getEntryId(), Long.toHexString(checksum), Integer.toHexString(computedChecksum)); return false; } } return true; }
if (!hasChecksum(headerFrame)) { return;
headerFrame.skipBytes(cmdSize); if (hasChecksum(headerFrame)) { int checksum = readChecksum(headerFrame);
public static void skipChecksumIfPresent(ByteBuf buffer) { if (hasChecksum(buffer)) { readChecksum(buffer); } }
private boolean verifyChecksum(ByteBuf headersAndPayload) { if (hasChecksum(headersAndPayload)) { int readerIndex = headersAndPayload.readerIndex(); try { int checksum = readChecksum(headersAndPayload); long computedChecksum = computeChecksum(headersAndPayload); if (checksum == computedChecksum) { return true; } else { log.error("[{}] [{}] Failed to verify checksum", topic, producerName); return false; } } finally { headersAndPayload.readerIndex(readerIndex); } } else { // ignore if checksum is not available if (log.isDebugEnabled()) { log.debug("[{}] [{}] Payload does not have checksum to verify", topic, producerName); } return true; } }
private boolean verifyChecksum(ByteBuf headersAndPayload, MessageIdData messageId) { if (hasChecksum(headersAndPayload)) { int checksum = readChecksum(headersAndPayload); int computedChecksum = computeChecksum(headersAndPayload); if (checksum != computedChecksum) { log.error( "[{}][{}] Checksum mismatch for message at {}:{}. Received checksum: 0x{}, Computed checksum: 0x{}", topic, subscription, messageId.getLedgerId(), messageId.getEntryId(), Long.toHexString(checksum), Integer.toHexString(computedChecksum)); return false; } } return true; }
public static boolean verifyChecksum(ByteBuf headersAndPayload, MessageIdData messageId, String topic, String subscription) { if (hasChecksum(headersAndPayload)) { int checksum = readChecksum(headersAndPayload); int computedChecksum = computeChecksum(headersAndPayload); if (checksum != computedChecksum) { log.error( "[{}][{}] Checksum mismatch for message at {}:{}. Received checksum: 0x{}, Computed checksum: 0x{}", topic, subscription, messageId.getLedgerId(), messageId.getEntryId(), Long.toHexString(checksum), Integer.toHexString(computedChecksum)); return false; } } return true; }
if (!hasChecksum(headerFrame)) { return;
headerFrame.skipBytes(cmdSize); if (hasChecksum(headerFrame)) { int checksum = readChecksum(headerFrame);