Jelajahi Sumber

ConnectionManager code cleanup

Tal Aloni 8 tahun lalu
induk
melakukan
6e660c810f

+ 6 - 9
ISCSI/ISCSI.Server/ConnectionManager.cs

@@ -78,19 +78,16 @@ namespace ISCSI.Server
 
         private int GetConnectionStateIndex(ulong isid, ushort tsih, ushort cid)
         {
-            lock (m_activeConnections)
+            for (int index = 0; index < m_activeConnections.Count; index++)
             {
-                for (int index = 0; index < m_activeConnections.Count; index++)
+                if (m_activeConnections[index].SessionParameters.ISID == isid &&
+                    m_activeConnections[index].SessionParameters.TSIH == tsih &&
+                    m_activeConnections[index].ConnectionParameters.CID == cid)
                 {
-                    if (m_activeConnections[index].SessionParameters.ISID == isid &&
-                        m_activeConnections[index].SessionParameters.TSIH == tsih &&
-                        m_activeConnections[index].ConnectionParameters.CID == cid)
-                    {
-                        return index;
-                    }
+                    return index;
                 }
-                return -1;
             }
+            return -1;
         }
     }
 }

+ 1 - 1
ISCSI/ISCSI.Server/ISCSIServer.cs

@@ -30,7 +30,7 @@ namespace ISCSI.Server
 
         private Socket m_listenerSocket;
         private bool m_listening;
-        public ConnectionManager m_connectionManager = new ConnectionManager();
+        private ConnectionManager m_connectionManager = new ConnectionManager();
 
         public event EventHandler<LogEntry> OnLogEntry;