예제 #1
0
        public void ProcessPDU(ISCSIPDU pdu, StateObject state)
        {
            if (pdu is NOPInPDU)
            {
                if (((NOPInPDU)pdu).TargetTransferTag != 0xFFFFFFFF)
                {
                    // Send NOP-OUT
                    NOPOutPDU response = ClientHelper.GetPingResponse((NOPInPDU)pdu, m_session, m_connection);
                    SendPDU(response);
                    return;
                }
            }

            if (m_connection.StatusNumberingStarted)
            {
                uint?responseStatSN = PDUHelper.GetStatSN(pdu);
                if (m_connection.ExpStatSN == responseStatSN)
                {
                    m_connection.ExpStatSN++;
                }
            }
            lock (m_incomingQueueLock)
            {
                m_incomingQueue.Add(pdu);
            }
        }
예제 #2
0
 public void SendPDU(ISCSIPDU request)
 {
     try
     {
         if (m_connection.StatusNumberingStarted)
         {
             PDUHelper.SetExpStatSN(request, m_connection.ExpStatSN);
         }
         m_clientSocket.Send(request.GetBytes());
         Log("[{0}][SendPDU] Sent request to target, Operation: {1}, Size: {2}", this.ConnectionIdentifier, (ISCSIOpCodeName)request.OpCode, request.Length);
     }
     catch (SocketException ex)
     {
         Log("[{0}][SendPDU] Failed to send PDU to target (Operation: {1}, Size: {2}), SocketException: {3}", this.ConnectionIdentifier, (ISCSIOpCodeName)request.OpCode, request.Length, ex.Message);
         m_isConnected = false;
     }
     catch (ObjectDisposedException)
     {
         m_isConnected = false;
     }
 }