/*
* TODO get (new or existing) session based on TSIH But since we don't do session reinstatement and
* MaxConnections=1, we can just create a new one.
*/
TargetSession session = new TargetSession(this, connection, initiatorSessionID, parser.getCommandSequenceNumber(),// set
// ExpCmdSN
// (PDU
// is
// immediate,
// hence
// no
// ++)
parser.getExpectedStatusSequenceNumber());
sessions.add(session);
// threadPool.submit(connection);// ignore returned Future
connection.call();
} catch (DigestException | InternetSCSIException | SettingsException e) {
LOGGER.info("Throws Exception", e);
continue;
}
}
} catch (IOException e) {
// this block is entered if the desired port is already in use
LOGGER.error("Throws Exception", e);
}
System.out.println("Closing socket channel.");
serverSocketChannel.close();
for(TargetSession session: sessions){
System.out.println("Commiting uncommited changes.");
session.getStorageModule().close();
}
return null;
}