Examples of TargetMessageParser


Examples of org.jscsi.parser.TargetMessageParser

        final Exception isCorrect = connection.getState().isCorrect(protocolDataUnit);
        if (isCorrect == null) {
            LOGGER.trace("Adding PDU to Receiving Queue.");

            final TargetMessageParser parser = (TargetMessageParser) protocolDataUnit.getBasicHeaderSegment().getParser();
            final Session session = connection.getSession();

            // the PDU maxCmdSN is greater than the local maxCmdSN, so we
            // have to update the local one
            if (session.getMaximumCommandSequenceNumber().compareTo(parser.getMaximumCommandSequenceNumber()) < 0) {
                session.setMaximumCommandSequenceNumber(parser.getMaximumCommandSequenceNumber());
            }

            // the PDU expCmdSN is greater than the local expCmdSN, so we
            // have to update the local one
            if (parser.incrementSequenceNumber()) {
                if (connection.getExpectedStatusSequenceNumber().compareTo(parser.getStatusSequenceNumber()) >= 0) {
                    connection.incrementExpectedStatusSequenceNumber();
                } else {
                    LOGGER.error("Status Sequence Number Mismatch (received, expected): " + parser.getStatusSequenceNumber() + ", " + (connection.getExpectedStatusSequenceNumber().getValue() - 1));
                }

            }

        } else {
View Full Code Here

Examples of org.jscsi.parser.TargetMessageParser

     */

    final void sendOverWire (final ProtocolDataUnit pdu) throws InternetSCSIException , IOException , InterruptedException {

        // set sequence counters
        final TargetMessageParser parser = (TargetMessageParser) pdu.getBasicHeaderSegment().getParser();
        parser.setExpectedCommandSequenceNumber(session.getExpectedCommandSequenceNumber().getValue());
        parser.setMaximumCommandSequenceNumber(session.getMaximumCommandSequenceNumber().getValue());
        final boolean incrementSequenceNumber = parser.incrementSequenceNumber();
        if (incrementSequenceNumber) // set StatSN only if field is not reserved
        parser.setStatusSequenceNumber(connection.getStatusSequenceNumber().getValue());

        if (LOGGER.isDebugEnabled()) LOGGER.debug("Sending this PDU:\n" + pdu);

        // send pdu
        pdu.write(socketChannel);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.