Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Plotnikov committed Oct 30, 2023
1 parent 8dce679 commit a396e72
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/java/com/exactpro/th2/FixHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,11 @@ private Map<String, String> transformProcessor(
FixField encryptedPassword = findField(message, NEW_ENCRYPTED_PASSWORD_TAG);
if(encryptedPassword != null) {
encryptedPassword.setValue(encrypt(transformation.getNewPassword(), transformation.getEncryptKey(), transformation.getPasswordEncryptAlgorithm(), transformation.getPasswordKeyEncryptAlgorithm()));
} else {
FixField defaultAppl = findField(message, DEFAULT_APPL_VER_ID_TAG);
if(defaultAppl != null) {
defaultAppl.insertNext(NEW_ENCRYPTED_PASSWORD_TAG, encrypt(transformation.getNewPassword(), transformation.getEncryptKey(), transformation.getPasswordEncryptAlgorithm(), transformation.getPasswordKeyEncryptAlgorithm()));
}
}
} else {
FixField encryptedPassword = findField(message, NEW_ENCRYPTED_PASSWORD_TAG);
Expand Down Expand Up @@ -1423,14 +1428,11 @@ private Map<String, String> transformOutgoingMessageStrategy(ByteBuf message, Ma

private Map<String, String> fakeRetransmissionOutgoingProcessor(ByteBuf message, Map<String, String> metadata) {
onOutgoingUpdateTag(message, metadata);
FixField msgType = findField(message, MSG_TYPE_TAG, US_ASCII);

FixField sendingTime = requireNonNull(findField(message, SENDING_TIME_TAG));
Integer retransmissionFlag = getRandomElementFromList(retransmissionFlags);
if(retransmissionFlag == null) return null;
strategy.getState().addMissedMessageToCacheIfCondition(msgSeqNum.get(), Unpooled.copiedBuffer(message), x -> true);

sendingTime.insertNext(retransmissionFlag, IS_POSS_DUP);
sendingTime.insertNext(POSS_DUP_TAG, IS_POSS_DUP).insertNext(POSS_RESEND_TAG, IS_POSS_DUP);

return null;
}
Expand Down Expand Up @@ -1868,9 +1870,9 @@ private void sendSequenceReset(RuleConfiguration configuration) {

StringBuilder sequenceReset = new StringBuilder();
String time = getTime();
setHeader(sequenceReset, MSG_TYPE_SEQUENCE_RESET, msgSeqNum.get() - 5, time);
setHeader(sequenceReset, MSG_TYPE_SEQUENCE_RESET, msgSeqNum.incrementAndGet(), time);
sequenceReset.append(ORIG_SENDING_TIME).append(time);
sequenceReset.append(NEW_SEQ_NO).append(msgSeqNum.get());
sequenceReset.append(NEW_SEQ_NO).append(msgSeqNum.get() - 5);
setChecksumAndBodyLength(sequenceReset);

channel.send(Unpooled.wrappedBuffer(sequenceReset.toString().getBytes(StandardCharsets.UTF_8)), Collections.emptyMap(), null, SendMode.HANDLE_AND_MANGLE)
Expand Down

0 comments on commit a396e72

Please sign in to comment.