diff --git a/docs/CliSecsSimulator.jar b/docs/CliSecsSimulator.jar index 8c5c544..c77747e 100644 Binary files a/docs/CliSecsSimulator.jar and b/docs/CliSecsSimulator.jar differ diff --git a/docs/SwingSecsSimulator.jar b/docs/SwingSecsSimulator.jar index dc23c3e..717e9c0 100644 Binary files a/docs/SwingSecsSimulator.jar and b/docs/SwingSecsSimulator.jar differ diff --git a/src/main/java/com/shimizukenta/secs/secs1/AbstractSecs1Communicator.java b/src/main/java/com/shimizukenta/secs/secs1/AbstractSecs1Communicator.java index 4c09544..45f89a8 100644 --- a/src/main/java/com/shimizukenta/secs/secs1/AbstractSecs1Communicator.java +++ b/src/main/java/com/shimizukenta/secs/secs1/AbstractSecs1Communicator.java @@ -254,59 +254,58 @@ private void entryCircuit() throws InterruptedException { try { - this.sendByte(ENQ); - - for (int retry = 0; retry <= this.secs1Config().retry().intValue(); ) { + for ( int retry = 0; retry <= this.secs1Config().retry().intValue(); ) { - Byte b = this.circuitQueue.pollByte(this.secs1Config().timeout().t2()); + this.sendByte(ENQ); - if ( b == null ) { - - this.notifyLog(Secs1RetryCircuitControlLog.newInstance(retry)); - retry += 1; + for ( ;; ) { - this.sendByte(ENQ); + Byte b = this.circuitQueue.pollByte(this.secs1Config().timeout().t2()); - } else if ( b.byteValue() == ENQ && ! this.secs1Config().isMaster().booleanValue() ) { + if ( b == null ) { - try { - this.receiveCircuit(); - } - catch ( SecsException e ) { - this.notifyLog(e); - } - - retry = 0; - pack.reset(); - - this.sendByte(ENQ); - - } else if ( b.byteValue() == EOT ) { - - if ( this.sendCircuit(pack.present()) ) { + this.notifyLog(Secs1RetryCircuitControlLog.newInstance(retry)); + retry += 1; + break; - if ( pack.ebit() ) { + } else if ( b.byteValue() == ENQ && ! this.secs1Config().isMaster().booleanValue() ) { - this.sendMgr.putSended(pack.message()); - this.offerSendedMsgPassThroughQueue(pack.message()); - this.notifyLog(new Secs1SendedMessageLog(pack.message())); + try { + this.receiveCircuit(); + } + catch ( SecsException e ) { + this.notifyLog(e); + } + + retry = 0; + pack.reset(); + break; + + } else if ( b.byteValue() == EOT ) { + + if ( this.sendCircuit(pack.present()) ) { - return; + if ( pack.ebit() ) { + + this.sendMgr.putSended(pack.message()); + this.offerSendedMsgPassThroughQueue(pack.message()); + this.notifyLog(new Secs1SendedMessageLog(pack.message())); + + return; + + } else { + + pack.next(); + retry = 0; + break; + } } else { - pack.next(); - retry = 0; - - this.sendByte(ENQ); + this.notifyLog(Secs1RetryCircuitControlLog.newInstance(retry)); + retry += 1; + break; } - - } else { - - this.notifyLog(Secs1RetryCircuitControlLog.newInstance(retry)); - retry += 1; - - this.sendByte(ENQ); } } }