iSCSI - E.4.3. 대상 알고리즘

목록

E.4.3. Target Algorithms

E.4.3. 타겟 알고리즘

Receive-a-In-PDU(Connection, CurrentPDU) { check-basic-validity(CurrentPDU); if (Header-Digest-Bad) discard, return; else if (Data-Digest-Bad) { Build-And-Send-Reject(Connection, CurrentPDU, Payload-Digest-Error); discard, return; } Retrieve TCB and Session. if (CurrentPDU.type == Logout) { if (CurrentPDU.ReasonCode = RecoveryRemove) { Retrieve the CleanupConnection from CurrentPDU.CID). for (each command active on CleanupConnection) { Quiesce-And-Prepare-for-New-Allegiance(Session, TCB); TCB.CurrentlyAllegiant = FALSE; } Cleanup-Connection-State(CleanupConnection); if ((quiescing successful) and (cleanup successful)) { Build-And-Send-Logout-Response(Connection, CleanupConnection.CID, Success); } else { Build-And-Send-Logout-Response(Connection, CleanupConnection.CID, Failure); } } } else if ((CurrentPDU.type == Login) and operational ErrorRecoveryLevel == 2) { Retrieve the CleanupConnection from CurrentPDU.CID). for (each command active on CleanupConnection) { Quiesce-And-Prepare-for-New-Allegiance(Session, TCB); TCB.CurrentlyAllegiant = FALSE; } Cleanup-Connection-State(CleanupConnection); if ((quiescing successful) and (cleanup successful)) { Continue with the rest of the Login processing; } else { Build-And-Send-Login-Response(Connection, CleanupConnection.CID, Target Error); } } } else if (CurrentPDU.type == TaskManagement) { if (CurrentPDU.function == "TaskReassign") { if (Session.ErrorRecoveryLevel < 2) { Build-And-Send-TaskMgmt-Response(Connection, CurrentPDU, "Allegiance reassignment not supported"); } else if (task is not found) { Build-And-Send-TaskMgmt-Response(Connection, CurrentPDU, "Task not in task set"); } else if (task is currently allegiant) { Build-And-Send-TaskMgmt-Response(Connection, CurrentPDU, "Task still allegiant"); } else { Establish-New-Allegiance(TCB, Connection); TCB.CurrentlyAllegiant = TRUE; Schedule-Command-To-Continue(TCB); } } } else { /* REST UNRELATED TO CONNECTION-RECOVERY, * NOT SHOWN */ } } Transport_Exception_Handler(Connection) { Connection.PerformConnectionCleanup = TRUE; if (the event is an unexpected transport disconnect) { Connection.State = CLEANUP_WAIT; Start-Timer(Connection-Resource-Timeout-Handler, Connection, (DefaultTime2Wait+DefaultTime2Retain)); if (this Session has full-feature phase connections left) { DifferentConnection = Pick-A-Logged-In-Connection(Session); Build-And-Send-Async(DifferentConnection, DroppedConnection, DefaultTime2Wait, DefaultTime2Retain); } } else { Connection.State = FREE; } }