Imported Upstream version 5.12.0.220

Former-commit-id: c477e03582759447177c6d4bf412cd2355aad476
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-04-24 09:31:23 +00:00
parent 8bd104cef2
commit 8fc30896db
1200 changed files with 29534 additions and 26161 deletions

View File

@ -46,21 +46,6 @@ namespace System.Web.SessionState
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public sealed class SessionStateModule : IHttpModule
{
class CallbackState
{
public readonly HttpContext Context;
public readonly AutoResetEvent AutoEvent;
public readonly string SessionId;
public readonly bool IsReadOnly;
public CallbackState (HttpContext context, AutoResetEvent e, string sessionId, bool isReadOnly) {
this.Context = context;
this.AutoEvent = e;
this.SessionId = sessionId;
this.IsReadOnly = isReadOnly;
}
}
internal const string HeaderName = "AspFilterSessionId";
internal const string CookielessFlagName = "_SessionIDManager_IsCookieLess";
@ -342,36 +327,22 @@ namespace System.Web.SessionState
return item;
}
void WaitForStoreUnlock (HttpContext context, string sessionId, bool isReadonly) {
AutoResetEvent are = new AutoResetEvent (false);
TimerCallback tc = new TimerCallback (StoreUnlockWaitCallback);
CallbackState cs = new CallbackState (context, are, sessionId, isReadonly);
using (Timer timer = new Timer (tc, cs, 500, 500)) {
try {
are.WaitOne (executionTimeout, false);
void WaitForStoreUnlock (HttpContext context, string sessionId, bool isReadOnly) {
DateTime dt = DateTime.Now;
while ((DateTime.Now - dt) < executionTimeout) {
Thread.Sleep(500);
storeData = GetStoreData (context, sessionId, isReadOnly);
if (storeData == null && storeLocked && (storeLockAge > executionTimeout)) {
handler.ReleaseItemExclusive (context, sessionId, storeLockId);
return;
}
catch {
storeData = null;
else if (storeData != null && !storeLocked) {
//we have the session
return;
}
}
}
void StoreUnlockWaitCallback (object s) {
CallbackState state = (CallbackState) s;
SessionStateStoreData item = GetStoreData (state.Context, state.SessionId, state.IsReadOnly);
if (item == null && storeLocked && (storeLockAge > executionTimeout)) {
handler.ReleaseItemExclusive (state.Context, state.SessionId, storeLockId);
storeData = null; // Create new state
state.AutoEvent.Set ();
}
else if (item != null && !storeLocked) {
storeData = item;
state.AutoEvent.Set ();
}
}
HttpSessionStateContainer CreateContainer (string sessionId, SessionStateStoreData data, bool isNew, bool isReadOnly) {
if (data == null)
return new HttpSessionStateContainer (