splatch commented on a change in pull request #170:
URL: https://github.com/apache/plc4x/pull/170#discussion_r543316951
##########
File path:
plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/readwrite/protocol/S7ProtocolLogic.java
##########
@@ -136,32 +154,27 @@ public void onConnect(ConversationContext<TPKTPacket>
context) {
return;
}
- // Prepare a message to request the remote to
identify itself.
- LOGGER.debug("Sending S7 Identification Request");
- TPKTPacket tpktPacket =
createIdentifyRemoteMessage();
- context.sendRequest(tpktPacket)
- .expectResponse(TPKTPacket.class,
REQUEST_TIMEOUT)
- .check(p -> p.getPayload() instanceof
COTPPacketData)
- .unwrap(p -> ((COTPPacketData) p.getPayload()))
- .check(p -> p.getPayload() instanceof
S7MessageUserData)
- .unwrap(p -> ((S7MessageUserData)
p.getPayload()))
- .check(p -> p.getPayload() instanceof
S7PayloadUserData)
- .handle(messageUserData -> {
- LOGGER.debug("Got S7 Identification
Response");
- S7PayloadUserData payloadUserData =
(S7PayloadUserData) messageUserData.getPayload();
-
extractControllerTypeAndFireConnected(context, payloadUserData);
- });
- });
- });
- }
- // This usually when we're running a passive mode river.
- else {
- LOGGER.info("S7 Driver running in PASSIVE mode.");
- s7DriverContext.setPassiveMode(true);
-
- // No login required, just confirm that we're connected.
- context.fireConnected();
- }
Review comment:
It is moved up in the method body so we do not have bigger block with
active connection under if brackets.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]