|
@@ -1,4 +1,4 @@
|
|
|
-
|
|
|
+
|
|
|
*
|
|
|
* You can redistribute this program and/or modify it under the terms of
|
|
|
* the GNU Lesser Public License as published by the Free Software Foundation,
|
|
@@ -26,7 +26,6 @@ namespace ISCSI.Client
|
|
|
private int m_targetPort;
|
|
|
private bool m_isConnected;
|
|
|
private Socket m_clientSocket;
|
|
|
- private IAsyncResult m_currentAsyncResult;
|
|
|
|
|
|
private object m_incomingQueueLock = new object();
|
|
|
private List<ISCSIPDU> m_incomingQueue = new List<ISCSIPDU>();
|
|
@@ -57,7 +56,7 @@ namespace ISCSI.Client
|
|
|
}
|
|
|
ConnectionState state = new ConnectionState();
|
|
|
ISCSIConnectionReceiveBuffer buffer = state.ReceiveBuffer;
|
|
|
- m_currentAsyncResult = m_clientSocket.BeginReceive(buffer.Buffer, buffer.WriteOffset, buffer.AvailableLength, SocketFlags.None, new AsyncCallback(OnClientSocketReceive), state);
|
|
|
+ m_clientSocket.BeginReceive(buffer.Buffer, buffer.WriteOffset, buffer.AvailableLength, SocketFlags.None, new AsyncCallback(OnClientSocketReceive), state);
|
|
|
m_isConnected = true;
|
|
|
}
|
|
|
return m_isConnected;
|
|
@@ -290,13 +289,6 @@ namespace ISCSI.Client
|
|
|
|
|
|
private void OnClientSocketReceive(IAsyncResult ar)
|
|
|
{
|
|
|
- if (ar != m_currentAsyncResult)
|
|
|
- {
|
|
|
-
|
|
|
-
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
ConnectionState state = (ConnectionState)ar.AsyncState;
|
|
|
|
|
|
if (!m_clientSocket.Connected)
|
|
@@ -309,6 +301,10 @@ namespace ISCSI.Client
|
|
|
{
|
|
|
numberOfBytesReceived = m_clientSocket.EndReceive(ar);
|
|
|
}
|
|
|
+ catch (ArgumentException)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
catch (ObjectDisposedException)
|
|
|
{
|
|
|
Log("[ReceiveCallback] EndReceive ObjectDisposedException");
|
|
@@ -332,7 +328,7 @@ namespace ISCSI.Client
|
|
|
|
|
|
try
|
|
|
{
|
|
|
- m_currentAsyncResult = m_clientSocket.BeginReceive(buffer.Buffer, buffer.WriteOffset, buffer.AvailableLength, SocketFlags.None, new AsyncCallback(OnClientSocketReceive), state);
|
|
|
+ m_clientSocket.BeginReceive(buffer.Buffer, buffer.WriteOffset, buffer.AvailableLength, SocketFlags.None, new AsyncCallback(OnClientSocketReceive), state);
|
|
|
}
|
|
|
catch (ObjectDisposedException)
|
|
|
{
|