diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLPresenceData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLPresenceData.cs | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/OpenSim/Data/MySQL/MySQLPresenceData.cs b/OpenSim/Data/MySQL/MySQLPresenceData.cs index e5dd0e5..4950f7f 100644 --- a/OpenSim/Data/MySQL/MySQLPresenceData.cs +++ b/OpenSim/Data/MySQL/MySQLPresenceData.cs | |||
@@ -123,27 +123,26 @@ namespace OpenSim.Data.MySQL | |||
123 | 123 | ||
124 | cmd.Parameters.AddWithValue("?UserID", userID); | 124 | cmd.Parameters.AddWithValue("?UserID", userID); |
125 | 125 | ||
126 | IDataReader reader = ExecuteReader(cmd); | 126 | using (IDataReader reader = cmd.ExecuteReader()) |
127 | |||
128 | List<UUID> deleteSessions = new List<UUID>(); | ||
129 | int online = 0; | ||
130 | |||
131 | while(reader.Read()) | ||
132 | { | 127 | { |
133 | if (bool.Parse(reader["Online"].ToString())) | ||
134 | online++; | ||
135 | else | ||
136 | deleteSessions.Add(new UUID(reader["SessionID"].ToString())); | ||
137 | } | ||
138 | 128 | ||
139 | if (online == 0 && deleteSessions.Count > 0) | 129 | List<UUID> deleteSessions = new List<UUID>(); |
140 | deleteSessions.RemoveAt(0); | 130 | int online = 0; |
141 | 131 | ||
142 | reader.Close(); | 132 | while(reader.Read()) |
143 | CloseReaderCommand(cmd); | 133 | { |
134 | if (bool.Parse(reader["Online"].ToString())) | ||
135 | online++; | ||
136 | else | ||
137 | deleteSessions.Add(new UUID(reader["SessionID"].ToString())); | ||
138 | } | ||
144 | 139 | ||
145 | foreach (UUID s in deleteSessions) | 140 | if (online == 0 && deleteSessions.Count > 0) |
146 | Delete("SessionID", s.ToString()); | 141 | deleteSessions.RemoveAt(0); |
142 | |||
143 | foreach (UUID s in deleteSessions) | ||
144 | Delete("SessionID", s.ToString()); | ||
145 | } | ||
147 | } | 146 | } |
148 | } | 147 | } |
149 | } | 148 | } |