Преглед изворни кода

2008-09-15 Marek Habersack <[email protected]>

	* SessionStateModule.cs: correctly let the handler know if an item
	is new when calling SetAndReleaseItemExclusive. Fixes bug #424797
	If handler's GetItem doesn't initialize storeLockId to a non-null
	value, initialize it to 0. Fixes bug #424797

svn path=/trunk/mcs/; revision=112997
Marek Habersack пре 17 година
родитељ
комит
4caac12664

+ 7 - 0
mcs/class/System.Web/System.Web.SessionState_2.0/ChangeLog

@@ -1,3 +1,10 @@
+2008-09-15  Marek Habersack  <[email protected]>
+
+	* SessionStateModule.cs: correctly let the handler know if an item
+	is new when calling SetAndReleaseItemExclusive. Fixes bug #424797
+	If handler's GetItem doesn't initialize storeLockId to a non-null
+	value, initialize it to 0. Fixes bug #424797
+
 2008-07-29  Marek Habersack  <[email protected]>
 
 	* SessionStateModule.cs: use Request.FilePath instead of

+ 9 - 6
mcs/class/System.Web/System.Web.SessionState_2.0/SessionStateModule.cs

@@ -82,7 +82,8 @@ namespace System.Web.SessionState
 		TimeSpan storeLockAge;
 		object storeLockId;
 		SessionStateActions storeSessionAction;
-
+		bool storeIsNew;
+		
 		// Session state
 		SessionStateStoreData storeData;
 		HttpSessionStateContainer container;
@@ -229,9 +230,9 @@ namespace System.Web.SessionState
 
 			GetStoreData (context, sessionId, isReadOnly);
 
-			bool isNew = false;
+			storeIsNew = false;
 			if (storeData == null && !storeLocked) {
-				isNew = true;
+				storeIsNew = true;
 				sessionId = idManager.CreateSessionID (context);
 				Trace.WriteLine ("New session ID allocated: " + sessionId);
 				bool redirected;
@@ -256,9 +257,9 @@ namespace System.Web.SessionState
 				storeData = handler.CreateNewStoreData (context, (int)config.Timeout.TotalMinutes);
 			}
 
-			container = CreateContainer (sessionId, storeData, isNew, isReadOnly);
+			container = CreateContainer (sessionId, storeData, storeIsNew, isReadOnly);
 			SessionStateUtility.AddHttpSessionStateToContext (app.Context, container);
-			if (isNew) {
+			if (storeIsNew) {
 				OnSessionStart ();
 				HttpSessionState hss = app.Session;
 
@@ -284,7 +285,7 @@ namespace System.Web.SessionState
 					Trace.WriteLine ("\tnot abandoned");
 					if (!container.IsReadOnly) {
 						Trace.WriteLine ("\tnot read only, storing and releasing");
-						handler.SetAndReleaseItemExclusive (context, container.SessionID, storeData, storeLockId, false);
+						handler.SetAndReleaseItemExclusive (context, container.SessionID, storeData, storeLockId, storeIsNew);
 					}
 					else {
 						Trace.WriteLine ("\tread only, releasing");
@@ -343,6 +344,8 @@ namespace System.Web.SessionState
 									  out storeLockAge,
 									  out storeLockId,
 									  out storeSessionAction);
+			if (storeLockId == null)
+				storeLockId = 0;
 		}
 
 		void WaitForStoreUnlock (HttpContext context, string sessionId, bool isReadonly) {