mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 01:41:17 -10:00
Compare commits
31
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
959fd8c59f | ||
|
|
a839ff27f9 | ||
|
|
a7157b51bb | ||
|
|
3bb01ace87 | ||
|
|
b9d887cbce | ||
|
|
61af8d3dcd | ||
|
|
8d417d7900 | ||
|
|
833b09f5dd | ||
|
|
16c3b35991 | ||
|
|
6f00242064 | ||
|
|
526cac9d5a | ||
|
|
193fb706f2 | ||
|
|
b41145223b | ||
|
|
a91d39e482 | ||
|
|
0081c27e0d | ||
|
|
6272eafb17 | ||
|
|
c68c72144d | ||
|
|
75c5d4a6c5 | ||
|
|
9c99885c9b | ||
|
|
b0dfc28659 | ||
|
|
d4511ef6b5 | ||
|
|
d6cc1326bc | ||
|
|
61fec75147 | ||
|
|
704ca7886e | ||
|
|
77d00e19fc | ||
|
|
5ec989143f | ||
|
|
69419b4be2 | ||
|
|
2bd6fef770 | ||
|
|
ad325d4b1c | ||
|
|
64f1d09b65 | ||
|
|
94bc52a101 |
No files matched your search
+2
-2
@@ -3,10 +3,10 @@ ACLOCAL_AMFLAGS = -I m4
|
||||
MONOTOUCH_SUBDIRS = $(libgc_dir) eglib/src mono
|
||||
|
||||
if CROSS_COMPILING
|
||||
SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) data runtime scripts man samples msvc $(docs_dir)
|
||||
SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) support data runtime scripts man samples msvc $(docs_dir)
|
||||
# Keep in sync with SUBDIRS
|
||||
## 'tools' is not normally built
|
||||
DIST_SUBDIRS = m4 po libgc eglib mono ikvm-native data runtime scripts man samples tools msvc docs
|
||||
DIST_SUBDIRS = m4 po libgc eglib mono ikvm-native support data runtime scripts man samples tools msvc docs
|
||||
else
|
||||
if ONLY_MONOTOUCH
|
||||
SUBDIRS = $(MONOTOUCH_SUBDIRS) runtime
|
||||
|
||||
+4
-5
@@ -386,7 +386,7 @@ static void GC_mark_togglerefs ()
|
||||
if (!GC_toggleref_array)
|
||||
return;
|
||||
|
||||
GC_set_mark_bit (GC_toggleref_array);
|
||||
GC_set_mark_bit ((GC_PTR)GC_toggleref_array);
|
||||
for (i = 0; i < GC_toggleref_array_size; ++i) {
|
||||
if (GC_toggleref_array [i].strong_ref) {
|
||||
GC_PTR object = GC_toggleref_array [i].strong_ref;
|
||||
@@ -424,7 +424,7 @@ ensure_toggleref_capacity (int capacity)
|
||||
{
|
||||
if (!GC_toggleref_array) {
|
||||
GC_toggleref_array_capacity = 32;
|
||||
GC_toggleref_array = (GCToggleRef *) GC_INTERNAL_MALLOC (GC_toggleref_array_capacity * sizeof (GCToggleRef), NORMAL);
|
||||
GC_toggleref_array = (GCToggleRef *) GC_INTERNAL_MALLOC_IGNORE_OFF_PAGE (GC_toggleref_array_capacity * sizeof (GCToggleRef), NORMAL);
|
||||
}
|
||||
if (GC_toggleref_array_size + capacity >= GC_toggleref_array_capacity) {
|
||||
GCToggleRef *tmp;
|
||||
@@ -432,10 +432,9 @@ ensure_toggleref_capacity (int capacity)
|
||||
while (GC_toggleref_array_capacity < GC_toggleref_array_size + capacity)
|
||||
GC_toggleref_array_capacity *= 2;
|
||||
|
||||
tmp = (GCToggleRef *) GC_INTERNAL_MALLOC (GC_toggleref_array_capacity * sizeof (GCToggleRef), NORMAL);
|
||||
tmp = (GCToggleRef *) GC_INTERNAL_MALLOC_IGNORE_OFF_PAGE (GC_toggleref_array_capacity * sizeof (GCToggleRef), NORMAL);
|
||||
memcpy (tmp, GC_toggleref_array, GC_toggleref_array_size * sizeof (GCToggleRef));
|
||||
|
||||
GC_free((GC_PTR)GC_toggleref_array);
|
||||
GC_INTERNAL_FREE (GC_toggleref_array);
|
||||
GC_toggleref_array = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -168,7 +168,11 @@ xammac_dirs := \
|
||||
System.Net.Http
|
||||
|
||||
monotouch_runtime_dirs := \
|
||||
corlib
|
||||
corlib \
|
||||
System \
|
||||
System.Core \
|
||||
System.XML \
|
||||
Mono.CSharp
|
||||
|
||||
monotouch_dirs := \
|
||||
Mono.CSharp \
|
||||
|
||||
@@ -21,7 +21,7 @@ ifeq (xammac, $(PROFILE))
|
||||
LIB_MCS_FLAGS += -d:FEATURE_CORE_DLR,FEATURE_REFEMIT
|
||||
endif
|
||||
|
||||
ifeq (monotouch, $(PROFILE))
|
||||
ifeq (monotouch, $(subst _runtime,,$(PROFILE)))
|
||||
LIBRARY_USE_INTERMEDIATE_FILE = yes
|
||||
|
||||
CYCLIC_DEPS := $(INTERPRETER_DEP)
|
||||
@@ -37,6 +37,10 @@ endif
|
||||
|
||||
endif
|
||||
|
||||
ifeq (monotouch_runtime, $(PROFILE))
|
||||
LIB_MCS_FLAGS += -d:FULL_AOT_RUNTIME
|
||||
endif
|
||||
|
||||
ifeq (4, $(FRAMEWORK_VERSION_MAJOR))
|
||||
LIB_MCS_FLAGS += -d:FEATURE_CORE_DLR,FEATURE_REFEMIT,FEATURE_PDBEMIT
|
||||
endif
|
||||
|
||||
@@ -56,7 +56,6 @@ namespace MonoTests.System.Linq.Expressions
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorkingInterpreter")]
|
||||
public void CompiledQuote ()
|
||||
{
|
||||
var quote42 = Expression.Lambda<Func<Expression<Func<int>>>> (
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#include monotouch_System.Core.dll.sources
|
||||
@@ -0,0 +1 @@
|
||||
#include mobile_System.Xml.dll.sources
|
||||
@@ -35,7 +35,7 @@ ifeq (moonlight_raw, $(PROFILE))
|
||||
LIB_MCS_FLAGS += -d:SECURITY_DEP
|
||||
endif
|
||||
endif
|
||||
ifeq (monotouch, $(PROFILE))
|
||||
ifeq (monotouch, $(subst _runtime,,$(PROFILE)))
|
||||
LIB_MCS_FLAGS += -d:SECURITY_DEP
|
||||
endif
|
||||
|
||||
|
||||
@@ -372,7 +372,6 @@ namespace System.Collections.Concurrent
|
||||
CheckArray (collections);
|
||||
WaitHandle[] wait_table = null;
|
||||
while (true) {
|
||||
int index = 0;
|
||||
for (int i = 0; i < collections.Length; ++i) {
|
||||
if (collections [i].TryTake (out item))
|
||||
return i;
|
||||
@@ -384,7 +383,6 @@ namespace System.Collections.Concurrent
|
||||
}
|
||||
WaitHandle.WaitAny (wait_table);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int TakeFromAny (BlockingCollection<T>[] collections, out T item, CancellationToken cancellationToken)
|
||||
@@ -393,7 +391,6 @@ namespace System.Collections.Concurrent
|
||||
CheckArray (collections);
|
||||
WaitHandle[] wait_table = null;
|
||||
while (true) {
|
||||
int index = 0;
|
||||
for (int i = 0; i < collections.Length; ++i) {
|
||||
if (collections [i].TryTake (out item))
|
||||
return i;
|
||||
@@ -408,8 +405,6 @@ namespace System.Collections.Concurrent
|
||||
WaitHandle.WaitAny (wait_table);
|
||||
cancellationToken.ThrowIfCancellationRequested ();
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int TryTakeFromAny (BlockingCollection<T>[] collections, out T item)
|
||||
|
||||
@@ -41,7 +41,10 @@ namespace System.Diagnostics {
|
||||
internal class TraceImplSettings {
|
||||
public const string Key = ".__TraceInfoSettingsKey__.";
|
||||
|
||||
// Disable warning that AutoFlush is not used
|
||||
#pragma warning disable 649
|
||||
public bool AutoFlush;
|
||||
#pragma warning restore
|
||||
//public int IndentLevel;
|
||||
public int IndentSize = 4;
|
||||
public TraceListenerCollection Listeners = new TraceListenerCollection (false);
|
||||
@@ -61,36 +64,11 @@ namespace System.Diagnostics {
|
||||
|
||||
private static bool autoFlush;
|
||||
|
||||
#if TARGET_JVM
|
||||
static readonly LocalDataStoreSlot _indentLevelStore = System.Threading.Thread.AllocateDataSlot ();
|
||||
static readonly LocalDataStoreSlot _indentSizeStore = System.Threading.Thread.AllocateDataSlot ();
|
||||
|
||||
private static int indentLevel {
|
||||
get {
|
||||
object o = System.Threading.Thread.GetData (_indentLevelStore);
|
||||
if (o == null)
|
||||
return 0;
|
||||
return (int) o;
|
||||
}
|
||||
set { System.Threading.Thread.SetData (_indentLevelStore, value); }
|
||||
}
|
||||
|
||||
private static int indentSize {
|
||||
get {
|
||||
object o = System.Threading.Thread.GetData (_indentSizeStore);
|
||||
if (o == null)
|
||||
return 0;
|
||||
return (int) o;
|
||||
}
|
||||
set { System.Threading.Thread.SetData (_indentSizeStore, value); }
|
||||
}
|
||||
#else
|
||||
[ThreadStatic]
|
||||
private static int indentLevel;
|
||||
|
||||
[ThreadStatic]
|
||||
private static int indentSize;
|
||||
#endif
|
||||
|
||||
#if MOBILE
|
||||
static TraceListenerCollection listeners = new TraceListenerCollection (true);
|
||||
|
||||
@@ -35,6 +35,7 @@ using System.Security.Cryptography.X509Certificates;
|
||||
#else
|
||||
extern alias PrebuiltSystem;
|
||||
using X509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -47,7 +48,6 @@ using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Mime;
|
||||
using System.Net.Sockets;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Reflection;
|
||||
|
||||
@@ -93,6 +93,8 @@ namespace System.Net.NetworkInformation {
|
||||
[MonoTODO("Only works on Linux. Returns 0 on other systems.")]
|
||||
public static int LoopbackInterfaceIndex {
|
||||
get {
|
||||
// Disable warning for code not reachable, due to runningOnUnix being always true on Monotouch
|
||||
#pragma warning disable 162
|
||||
if (runningOnUnix) {
|
||||
try {
|
||||
return UnixNetworkInterface.IfNameToIndex ("lo");
|
||||
@@ -101,6 +103,7 @@ namespace System.Net.NetworkInformation {
|
||||
}
|
||||
} else
|
||||
return 0;
|
||||
#pragma warning restore 162
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ namespace System.Net
|
||||
bool allowBuffering = true;
|
||||
X509CertificateCollection certificates;
|
||||
string connectionGroup;
|
||||
bool haveContentLength;
|
||||
long contentLength = -1;
|
||||
HttpContinueDelegate continueDelegate;
|
||||
CookieContainer cookieContainer;
|
||||
@@ -277,6 +278,7 @@ namespace System.Net
|
||||
throw new ArgumentOutOfRangeException ("value", "Content-Length must be >= 0");
|
||||
|
||||
contentLength = value;
|
||||
haveContentLength = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -593,10 +595,11 @@ namespace System.Net
|
||||
get { return servicePoint; }
|
||||
}
|
||||
#if NET_4_0
|
||||
[MonoTODO ("for portable library support")]
|
||||
public virtual bool SupportsCookieContainer {
|
||||
get {
|
||||
throw new NotImplementedException ();
|
||||
// The managed implementation supports the cookie container
|
||||
// it is only Silverlight that returns false here
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -862,29 +865,29 @@ namespace System.Net
|
||||
return EndGetRequestStream (asyncResult);
|
||||
}
|
||||
|
||||
WebAsyncResult CheckIfForceWrite (AsyncCallback callback, object state)
|
||||
bool CheckIfForceWrite (SimpleAsyncResult result)
|
||||
{
|
||||
if (writeStream == null || writeStream.RequestWritten || !InternalAllowBuffering)
|
||||
return null;
|
||||
#if NET_4_0
|
||||
return false;
|
||||
#if NET_4_0
|
||||
if (contentLength < 0 && writeStream.CanWrite == true && writeStream.WriteBufferLength < 0)
|
||||
return null;
|
||||
return false;
|
||||
|
||||
if (contentLength < 0 && writeStream.WriteBufferLength >= 0)
|
||||
InternalContentLength = writeStream.WriteBufferLength;
|
||||
#else
|
||||
#else
|
||||
if (contentLength < 0 && writeStream.CanWrite == true)
|
||||
return null;
|
||||
#endif
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// This will write the POST/PUT if the write stream already has the expected
|
||||
// amount of bytes in it (ContentLength) (bug #77753) or if the write stream
|
||||
// contains data and it has been closed already (xamarin bug #1512).
|
||||
|
||||
if (writeStream.WriteBufferLength == contentLength || (contentLength == -1 && writeStream.CanWrite == false))
|
||||
return writeStream.WriteRequestAsync (callback, state);
|
||||
return writeStream.WriteRequestAsync (result);
|
||||
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state)
|
||||
@@ -911,59 +914,41 @@ namespace System.Net
|
||||
WebAsyncResult aread = asyncRead;
|
||||
initialMethod = method;
|
||||
|
||||
aread.InnerAsyncResult = CheckIfForceWrite (GetResponseAsyncCB, aread);
|
||||
if (aread.InnerAsyncResult == null)
|
||||
GetResponseAsyncCB2 (aread);
|
||||
else
|
||||
Monitor.Exit (locker);
|
||||
return aread;
|
||||
}
|
||||
SimpleAsyncResult.RunWithLock (locker, CheckIfForceWrite, inner => {
|
||||
var synch = inner.CompletedSynchronously;
|
||||
|
||||
void GetResponseAsyncCB (IAsyncResult ar)
|
||||
{
|
||||
var result = (WebAsyncResult)ar;
|
||||
var innerResult = (WebAsyncResult)result.InnerAsyncResult;
|
||||
result.InnerAsyncResult = null;
|
||||
|
||||
if (innerResult != null && innerResult.GotException) {
|
||||
asyncRead.SetCompleted (true, innerResult.Exception);
|
||||
asyncRead.DoCallback ();
|
||||
return;
|
||||
}
|
||||
|
||||
Monitor.Enter (locker);
|
||||
GetResponseAsyncCB2 ((WebAsyncResult)ar);
|
||||
}
|
||||
|
||||
void GetResponseAsyncCB2 (WebAsyncResult aread)
|
||||
{
|
||||
if (haveResponse) {
|
||||
Exception saved = saved_exc;
|
||||
if (webResponse != null) {
|
||||
Monitor.Exit (locker);
|
||||
if (saved == null) {
|
||||
aread.SetCompleted (true, webResponse);
|
||||
} else {
|
||||
aread.SetCompleted (true, saved);
|
||||
}
|
||||
aread.DoCallback ();
|
||||
return;
|
||||
} else if (saved != null) {
|
||||
Monitor.Exit (locker);
|
||||
aread.SetCompleted (true, saved);
|
||||
if (inner.GotException) {
|
||||
aread.SetCompleted (synch, inner.Exception);
|
||||
aread.DoCallback ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!requestSent) {
|
||||
requestSent = true;
|
||||
redirects = 0;
|
||||
servicePoint = GetServicePoint ();
|
||||
abortHandler = servicePoint.SendRequest (this, connectionGroup);
|
||||
}
|
||||
if (haveResponse) {
|
||||
Exception saved = saved_exc;
|
||||
if (webResponse != null) {
|
||||
if (saved == null) {
|
||||
aread.SetCompleted (synch, webResponse);
|
||||
} else {
|
||||
aread.SetCompleted (synch, saved);
|
||||
}
|
||||
aread.DoCallback ();
|
||||
return;
|
||||
} else if (saved != null) {
|
||||
aread.SetCompleted (synch, saved);
|
||||
aread.DoCallback ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Monitor.Exit (locker);
|
||||
if (!requestSent) {
|
||||
requestSent = true;
|
||||
redirects = 0;
|
||||
servicePoint = GetServicePoint ();
|
||||
abortHandler = servicePoint.SendRequest (this, connectionGroup);
|
||||
}
|
||||
});
|
||||
|
||||
return aread;
|
||||
}
|
||||
|
||||
public override WebResponse EndGetResponse (IAsyncResult asyncResult)
|
||||
@@ -1108,8 +1093,15 @@ namespace System.Net
|
||||
if (continueDelegate != null)
|
||||
continueDelegate (statusCode, headers);
|
||||
}
|
||||
|
||||
void RewriteRedirectToGet ()
|
||||
{
|
||||
method = "GET";
|
||||
webHeaders.RemoveInternal ("Transfer-Encoding");
|
||||
sendChunked = false;
|
||||
}
|
||||
|
||||
bool Redirect (WebAsyncResult result, HttpStatusCode code)
|
||||
bool Redirect (WebAsyncResult result, HttpStatusCode code, WebResponse response)
|
||||
{
|
||||
redirects++;
|
||||
Exception e = null;
|
||||
@@ -1121,12 +1113,12 @@ namespace System.Net
|
||||
case HttpStatusCode.MovedPermanently: // 301
|
||||
case HttpStatusCode.Redirect: // 302
|
||||
if (method == "POST")
|
||||
method = "GET";
|
||||
RewriteRedirectToGet ();
|
||||
break;
|
||||
case HttpStatusCode.TemporaryRedirect: // 307
|
||||
break;
|
||||
case HttpStatusCode.SeeOther: //303
|
||||
method = "GET";
|
||||
RewriteRedirectToGet ();
|
||||
break;
|
||||
case HttpStatusCode.NotModified: // 304
|
||||
return false;
|
||||
@@ -1139,12 +1131,13 @@ namespace System.Net
|
||||
break;
|
||||
}
|
||||
|
||||
if (method != "GET" && !InternalAllowBuffering)
|
||||
e = new WebException ("The request requires buffering data to succeed.", null, WebExceptionStatus.ProtocolError, webResponse);
|
||||
|
||||
if (e != null)
|
||||
throw e;
|
||||
|
||||
contentLength = -1;
|
||||
//bodyBufferLength = 0;
|
||||
//bodyBuffer = null;
|
||||
uriString = webResponse.Headers ["Location"];
|
||||
|
||||
if (uriString == null)
|
||||
@@ -1174,12 +1167,15 @@ namespace System.Net
|
||||
} else if (contentLength != -1) {
|
||||
if (auth_state.NtlmAuthState == NtlmAuthState.Challenge || proxy_auth_state.NtlmAuthState == NtlmAuthState.Challenge) {
|
||||
// We don't send any body with the NTLM Challenge request.
|
||||
webHeaders.SetInternal ("Content-Length", "0");
|
||||
if (haveContentLength || gotRequestStream || contentLength > 0)
|
||||
webHeaders.SetInternal ("Content-Length", "0");
|
||||
else
|
||||
webHeaders.RemoveInternal ("Content-Length");
|
||||
} else {
|
||||
if (contentLength > 0)
|
||||
continue100 = true;
|
||||
|
||||
if (gotRequestStream || contentLength > 0)
|
||||
if (haveContentLength || gotRequestStream || contentLength > 0)
|
||||
webHeaders.SetInternal ("Content-Length", contentLength.ToString ());
|
||||
}
|
||||
webHeaders.RemoveInternal ("Transfer-Encoding");
|
||||
@@ -1309,16 +1305,52 @@ namespace System.Net
|
||||
writeStream.SendChunked = false;
|
||||
}
|
||||
|
||||
try {
|
||||
var result = writeStream.SetHeadersAsync (false, SetWriteStreamCB, null);
|
||||
if (result == null)
|
||||
SetWriteStreamCB (null);
|
||||
} catch (Exception exc) {
|
||||
SetWriteStreamErrorCB (exc);
|
||||
}
|
||||
writeStream.SetHeadersAsync (false, result => {
|
||||
if (result.GotException) {
|
||||
SetWriteStreamError (result.Exception);
|
||||
return;
|
||||
}
|
||||
|
||||
haveRequest = true;
|
||||
|
||||
SetWriteStreamInner (inner => {
|
||||
if (inner.GotException) {
|
||||
SetWriteStreamError (inner.Exception);
|
||||
return;
|
||||
}
|
||||
|
||||
if (asyncWrite != null) {
|
||||
asyncWrite.SetCompleted (inner.CompletedSynchronously, writeStream);
|
||||
asyncWrite.DoCallback ();
|
||||
asyncWrite = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void SetWriteStreamErrorCB (Exception exc)
|
||||
SimpleAsyncResult SetWriteStreamInner (SimpleAsyncCallback callback)
|
||||
{
|
||||
return SimpleAsyncResult.Run (result => {
|
||||
if (bodyBuffer != null) {
|
||||
// The body has been written and buffered. The request "user"
|
||||
// won't write it again, so we must do it.
|
||||
if (auth_state.NtlmAuthState != NtlmAuthState.Challenge && proxy_auth_state.NtlmAuthState != NtlmAuthState.Challenge) {
|
||||
// FIXME: this is a blocking call on the thread pool that could lead to thread pool exhaustion
|
||||
writeStream.Write (bodyBuffer, 0, bodyBufferLength);
|
||||
bodyBuffer = null;
|
||||
writeStream.Close ();
|
||||
}
|
||||
} else if (method != "HEAD" && method != "GET" && method != "MKCOL" && method != "CONNECT" &&
|
||||
method != "TRACE") {
|
||||
if (getResponseCalled && !writeStream.RequestWritten)
|
||||
return writeStream.WriteRequestAsync (result);
|
||||
}
|
||||
|
||||
return false;
|
||||
}, callback);
|
||||
}
|
||||
|
||||
void SetWriteStreamError (Exception exc)
|
||||
{
|
||||
WebException wexc = exc as WebException;
|
||||
if (wexc != null)
|
||||
@@ -1327,53 +1359,6 @@ namespace System.Net
|
||||
SetWriteStreamError (WebExceptionStatus.SendFailure, exc);
|
||||
}
|
||||
|
||||
void SetWriteStreamCB (IAsyncResult ar)
|
||||
{
|
||||
WebAsyncResult result = ar as WebAsyncResult;
|
||||
|
||||
if (result != null && result.Exception != null) {
|
||||
SetWriteStreamErrorCB (result.Exception);
|
||||
return;
|
||||
}
|
||||
|
||||
haveRequest = true;
|
||||
|
||||
WebAsyncResult writeRequestResult = null;
|
||||
|
||||
if (bodyBuffer != null) {
|
||||
// The body has been written and buffered. The request "user"
|
||||
// won't write it again, so we must do it.
|
||||
if (auth_state.NtlmAuthState != NtlmAuthState.Challenge && proxy_auth_state.NtlmAuthState != NtlmAuthState.Challenge) {
|
||||
// FIXME: this is a blocking call on the thread pool that could lead to thread pool exhaustion
|
||||
writeStream.Write (bodyBuffer, 0, bodyBufferLength);
|
||||
bodyBuffer = null;
|
||||
writeStream.Close ();
|
||||
}
|
||||
} else if (method != "HEAD" && method != "GET" && method != "MKCOL" && method != "CONNECT" &&
|
||||
method != "TRACE") {
|
||||
if (getResponseCalled && !writeStream.RequestWritten)
|
||||
writeRequestResult = writeStream.WriteRequestAsync (SetWriteStreamCB2, null);
|
||||
}
|
||||
|
||||
if (writeRequestResult == null)
|
||||
SetWriteStreamCB2 (null);
|
||||
}
|
||||
|
||||
void SetWriteStreamCB2 (IAsyncResult ar)
|
||||
{
|
||||
var result = (WebAsyncResult)ar;
|
||||
if (result != null && result.GotException) {
|
||||
SetWriteStreamErrorCB (result.Exception);
|
||||
return;
|
||||
}
|
||||
|
||||
if (asyncWrite != null) {
|
||||
asyncWrite.SetCompleted (false, writeStream);
|
||||
asyncWrite.DoCallback ();
|
||||
asyncWrite = null;
|
||||
}
|
||||
}
|
||||
|
||||
internal void SetResponseError (WebExceptionStatus status, Exception e, string where)
|
||||
{
|
||||
if (Aborted)
|
||||
@@ -1517,6 +1502,11 @@ namespace System.Net
|
||||
r.SetCompleted (false, webResponse);
|
||||
r.DoCallback ();
|
||||
} else {
|
||||
if (sendChunked) {
|
||||
sendChunked = false;
|
||||
webHeaders.RemoveInternal ("Transfer-Encoding");
|
||||
}
|
||||
|
||||
if (webResponse != null) {
|
||||
if (HandleNtlmAuth (r))
|
||||
return;
|
||||
@@ -1651,11 +1641,7 @@ namespace System.Net
|
||||
if (!usedPreAuth && CheckAuthorization (webResponse, code)) {
|
||||
// Keep the written body, so it can be rewritten in the retry
|
||||
if (InternalAllowBuffering) {
|
||||
// NTLM: This is to avoid sending data in the 'challenge' request
|
||||
// We save it in the first request (first 401), don't send anything
|
||||
// in the challenge request and send it in the response request along
|
||||
// with the buffers kept form the first request.
|
||||
if (auth_state.NtlmAuthState == NtlmAuthState.Challenge || proxy_auth_state.NtlmAuthState == NtlmAuthState.Challenge) {
|
||||
if (writeStream.WriteBufferLength > 0) {
|
||||
bodyBuffer = writeStream.WriteBuffer;
|
||||
bodyBufferLength = writeStream.WriteBufferLength;
|
||||
}
|
||||
@@ -1702,7 +1688,7 @@ namespace System.Net
|
||||
bool b = false;
|
||||
int c = (int) code;
|
||||
if (allowAutoRedirect && c >= 300) {
|
||||
b = Redirect (result, code);
|
||||
b = Redirect (result, code, webResponse);
|
||||
if (InternalAllowBuffering && writeStream.WriteBufferLength > 0) {
|
||||
bodyBuffer = writeStream.WriteBuffer;
|
||||
bodyBufferLength = writeStream.WriteBufferLength;
|
||||
|
||||
@@ -52,7 +52,6 @@ namespace System.Net
|
||||
X509Certificate clientCertificate;
|
||||
IPHostEntry host;
|
||||
bool usesProxy;
|
||||
WebConnectionGroup firstGroup;
|
||||
Dictionary<string,WebConnectionGroup> groups;
|
||||
bool sendContinue = true;
|
||||
bool useConnect;
|
||||
@@ -255,45 +254,25 @@ namespace System.Net
|
||||
*/
|
||||
|
||||
WebConnectionGroup group;
|
||||
if (firstGroup != null && name == firstGroup.Name)
|
||||
return firstGroup;
|
||||
if (groups != null && groups.TryGetValue (name, out group))
|
||||
return group;
|
||||
|
||||
group = new WebConnectionGroup (this, name);
|
||||
group.ConnectionClosed += (s, e) => currentConnections--;
|
||||
|
||||
if (firstGroup == null)
|
||||
firstGroup = group;
|
||||
else {
|
||||
if (groups == null)
|
||||
groups = new Dictionary<string, WebConnectionGroup> ();
|
||||
groups.Add (name, group);
|
||||
}
|
||||
if (groups == null)
|
||||
groups = new Dictionary<string, WebConnectionGroup> ();
|
||||
groups.Add (name, group);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
void RemoveConnectionGroup (WebConnectionGroup group)
|
||||
{
|
||||
if (groups == null || groups.Count == 0) {
|
||||
// No more connection groups left.
|
||||
if (group != firstGroup)
|
||||
throw new InvalidOperationException ();
|
||||
else
|
||||
firstGroup = null;
|
||||
return;
|
||||
}
|
||||
if (groups == null || groups.Count == 0)
|
||||
throw new InvalidOperationException ();
|
||||
|
||||
if (group == firstGroup) {
|
||||
// Steal one entry from the dictionary.
|
||||
var en = groups.GetEnumerator ();
|
||||
en.MoveNext ();
|
||||
firstGroup = en.Current.Value;
|
||||
groups.Remove (en.Current.Key);
|
||||
} else {
|
||||
groups.Remove (group.Name);
|
||||
}
|
||||
groups.Remove (group.Name);
|
||||
}
|
||||
|
||||
internal bool CheckAvailableForRecycling (out DateTime outIdleSince)
|
||||
@@ -301,10 +280,9 @@ namespace System.Net
|
||||
outIdleSince = DateTime.MinValue;
|
||||
|
||||
TimeSpan idleTimeSpan;
|
||||
WebConnectionGroup singleGroup, singleRemove = null;
|
||||
List<WebConnectionGroup> groupList = null, removeList = null;
|
||||
lock (this) {
|
||||
if (firstGroup == null) {
|
||||
if (groups == null || groups.Count == 0) {
|
||||
idleSince = DateTime.MinValue;
|
||||
return true;
|
||||
}
|
||||
@@ -320,30 +298,20 @@ namespace System.Net
|
||||
*
|
||||
*/
|
||||
|
||||
singleGroup = firstGroup;
|
||||
if (groups != null)
|
||||
groupList = new List<WebConnectionGroup> (groups.Values);
|
||||
groupList = new List<WebConnectionGroup> (groups.Values);
|
||||
}
|
||||
|
||||
if (singleGroup.TryRecycle (idleTimeSpan, ref outIdleSince))
|
||||
singleRemove = singleGroup;
|
||||
|
||||
if (groupList != null) {
|
||||
foreach (var group in groupList) {
|
||||
if (!group.TryRecycle (idleTimeSpan, ref outIdleSince))
|
||||
continue;
|
||||
if (removeList == null)
|
||||
removeList = new List<WebConnectionGroup> ();
|
||||
removeList.Add (group);
|
||||
}
|
||||
foreach (var group in groupList) {
|
||||
if (!group.TryRecycle (idleTimeSpan, ref outIdleSince))
|
||||
continue;
|
||||
if (removeList == null)
|
||||
removeList = new List<WebConnectionGroup> ();
|
||||
removeList.Add (group);
|
||||
}
|
||||
|
||||
lock (this) {
|
||||
idleSince = outIdleSince;
|
||||
|
||||
if (singleRemove != null)
|
||||
RemoveConnectionGroup (singleRemove);
|
||||
|
||||
if (removeList != null) {
|
||||
foreach (var group in removeList)
|
||||
RemoveConnectionGroup (group);
|
||||
@@ -352,9 +320,11 @@ namespace System.Net
|
||||
if (groups != null && groups.Count == 0)
|
||||
groups = null;
|
||||
|
||||
if (firstGroup == null) {
|
||||
idleTimer.Dispose ();
|
||||
idleTimer = null;
|
||||
if (groups == null) {
|
||||
if (idleTimer != null) {
|
||||
idleTimer.Dispose ();
|
||||
idleTimer = null;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -264,7 +264,6 @@ namespace System.Net
|
||||
throw new ArgumentException ("value");
|
||||
|
||||
maxServicePoints = value;
|
||||
RecycleServicePoints ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,9 +328,6 @@ namespace System.Net
|
||||
if (address == null)
|
||||
throw new ArgumentNullException ("address");
|
||||
|
||||
if ((servicePoints.Count % 4) == 0)
|
||||
RecycleServicePoints ();
|
||||
|
||||
var origAddress = new Uri (address.Scheme + "://" + address.Authority);
|
||||
|
||||
bool usesProxy = false;
|
||||
@@ -378,41 +374,6 @@ namespace System.Net
|
||||
return sp;
|
||||
}
|
||||
|
||||
// Internal Methods
|
||||
|
||||
static void RecycleServicePoints ()
|
||||
{
|
||||
lock (servicePoints) {
|
||||
var toRemove = new ArrayList ();
|
||||
var idleList = new SortedDictionary<DateTime, ServicePoint> ();
|
||||
IDictionaryEnumerator e = servicePoints.GetEnumerator ();
|
||||
while (e.MoveNext ()) {
|
||||
ServicePoint sp = (ServicePoint) e.Value;
|
||||
DateTime idleSince;
|
||||
if (sp.CheckAvailableForRecycling (out idleSince)) {
|
||||
toRemove.Add (e.Key);
|
||||
continue;
|
||||
}
|
||||
|
||||
while (idleList.ContainsKey (idleSince))
|
||||
idleSince = idleSince.AddMilliseconds (1);
|
||||
idleList.Add (idleSince, sp);
|
||||
}
|
||||
|
||||
for (int i = 0; i < toRemove.Count; i++)
|
||||
servicePoints.Remove (toRemove [i]);
|
||||
|
||||
if (maxServicePoints == 0 || servicePoints.Count <= maxServicePoints)
|
||||
return;
|
||||
|
||||
// get rid of the ones with the longest idle time
|
||||
foreach (var sp in idleList.Values) {
|
||||
if (servicePoints.Count <= maxServicePoints)
|
||||
break;
|
||||
servicePoints.Remove (sp);
|
||||
}
|
||||
}
|
||||
}
|
||||
#if SECURITY_DEP
|
||||
internal class ChainValidationHelper {
|
||||
object sender;
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
//
|
||||
// System.Net.WebAsyncResult
|
||||
//
|
||||
// Authors:
|
||||
// Gonzalo Paniagua Javier ([email protected])
|
||||
// Martin Baulig ([email protected])
|
||||
//
|
||||
// (C) 2003 Ximian, Inc (http://www.ximian.com)
|
||||
// Copyright (c) 2014 Xamarin Inc. (http://www.xamarin.com)
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
delegate void SimpleAsyncCallback (SimpleAsyncResult result);
|
||||
|
||||
delegate bool SimpleAsyncFunc (SimpleAsyncResult result);
|
||||
|
||||
class SimpleAsyncResult : IAsyncResult
|
||||
{
|
||||
ManualResetEvent handle;
|
||||
bool synch;
|
||||
bool isCompleted;
|
||||
SimpleAsyncCallback cb;
|
||||
object state;
|
||||
bool callbackDone;
|
||||
Exception exc;
|
||||
object locker = new object ();
|
||||
|
||||
SimpleAsyncResult (SimpleAsyncCallback cb)
|
||||
{
|
||||
this.cb = cb;
|
||||
}
|
||||
|
||||
protected SimpleAsyncResult (AsyncCallback cb, object state)
|
||||
{
|
||||
this.state = state;
|
||||
this.cb = result => {
|
||||
if (cb != null)
|
||||
cb (this);
|
||||
};
|
||||
}
|
||||
|
||||
public static SimpleAsyncResult Run (SimpleAsyncFunc func, SimpleAsyncCallback callback)
|
||||
{
|
||||
var result = new SimpleAsyncResult (callback);
|
||||
try {
|
||||
if (!func (result))
|
||||
result.SetCompleted (true);
|
||||
} catch (Exception ex) {
|
||||
result.SetCompleted (true, ex);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static SimpleAsyncResult RunWithLock (object locker, SimpleAsyncFunc func, SimpleAsyncCallback callback)
|
||||
{
|
||||
return Run (inner => {
|
||||
bool running = func (inner);
|
||||
if (running)
|
||||
Monitor.Exit (locker);
|
||||
return running;
|
||||
}, inner => {
|
||||
if (inner.GotException) {
|
||||
if (inner.CompletedSynchronously)
|
||||
Monitor.Exit (locker);
|
||||
callback (inner);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!inner.CompletedSynchronously)
|
||||
Monitor.Enter (locker);
|
||||
|
||||
callback (inner);
|
||||
} finally {
|
||||
Monitor.Exit (locker);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void Reset_internal ()
|
||||
{
|
||||
callbackDone = false;
|
||||
exc = null;
|
||||
exc = null;
|
||||
lock (locker) {
|
||||
isCompleted = false;
|
||||
if (handle != null)
|
||||
handle.Reset ();
|
||||
}
|
||||
}
|
||||
|
||||
internal void SetCompleted (bool synch, Exception e)
|
||||
{
|
||||
SetCompleted_internal (synch, e);
|
||||
DoCallback_private ();
|
||||
}
|
||||
|
||||
internal void SetCompleted (bool synch)
|
||||
{
|
||||
SetCompleted_internal (synch);
|
||||
DoCallback_private ();
|
||||
}
|
||||
|
||||
protected void SetCompleted_internal (bool synch, Exception e)
|
||||
{
|
||||
this.synch = synch;
|
||||
exc = e;
|
||||
lock (locker) {
|
||||
isCompleted = true;
|
||||
if (handle != null)
|
||||
handle.Set ();
|
||||
}
|
||||
}
|
||||
|
||||
protected void SetCompleted_internal (bool synch)
|
||||
{
|
||||
this.synch = synch;
|
||||
exc = null;
|
||||
lock (locker) {
|
||||
isCompleted = true;
|
||||
if (handle != null)
|
||||
handle.Set ();
|
||||
}
|
||||
}
|
||||
|
||||
void DoCallback_private ()
|
||||
{
|
||||
if (callbackDone)
|
||||
return;
|
||||
callbackDone = true;
|
||||
if (cb == null)
|
||||
return;
|
||||
cb (this);
|
||||
}
|
||||
|
||||
protected void DoCallback_internal ()
|
||||
{
|
||||
if (!callbackDone && cb != null) {
|
||||
callbackDone = true;
|
||||
// if (true || synch)
|
||||
cb (this);
|
||||
// else
|
||||
// ThreadPool.QueueUserWorkItem (CB, null);
|
||||
}
|
||||
}
|
||||
|
||||
void CB (object unused)
|
||||
{
|
||||
cb (this);
|
||||
}
|
||||
|
||||
internal void WaitUntilComplete ()
|
||||
{
|
||||
if (IsCompleted)
|
||||
return;
|
||||
|
||||
AsyncWaitHandle.WaitOne ();
|
||||
}
|
||||
|
||||
internal bool WaitUntilComplete (int timeout, bool exitContext)
|
||||
{
|
||||
if (IsCompleted)
|
||||
return true;
|
||||
|
||||
return AsyncWaitHandle.WaitOne (timeout, exitContext);
|
||||
}
|
||||
|
||||
public object AsyncState {
|
||||
get { return state; }
|
||||
}
|
||||
|
||||
public WaitHandle AsyncWaitHandle {
|
||||
get {
|
||||
lock (locker) {
|
||||
if (handle == null)
|
||||
handle = new ManualResetEvent (isCompleted);
|
||||
}
|
||||
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CompletedSynchronously {
|
||||
get { return synch; }
|
||||
}
|
||||
|
||||
public bool IsCompleted {
|
||||
get {
|
||||
lock (locker) {
|
||||
return isCompleted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal bool GotException {
|
||||
get { return (exc != null); }
|
||||
}
|
||||
|
||||
internal Exception Exception {
|
||||
get { return exc; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,173 +33,67 @@ using System.Threading;
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
class WebAsyncResult : IAsyncResult
|
||||
class WebAsyncResult : SimpleAsyncResult
|
||||
{
|
||||
ManualResetEvent handle;
|
||||
bool synch;
|
||||
bool isCompleted;
|
||||
AsyncCallback cb;
|
||||
object state;
|
||||
int nbytes;
|
||||
IAsyncResult innerAsyncResult;
|
||||
bool callbackDone;
|
||||
Exception exc;
|
||||
HttpWebResponse response;
|
||||
Stream writeStream;
|
||||
byte [] buffer;
|
||||
int offset;
|
||||
int size;
|
||||
object locker = new object ();
|
||||
public bool EndCalled;
|
||||
public bool AsyncWriteAll;
|
||||
|
||||
public WebAsyncResult (AsyncCallback cb, object state)
|
||||
: base (cb, state)
|
||||
{
|
||||
this.cb = cb;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public WebAsyncResult (HttpWebRequest request, AsyncCallback cb, object state)
|
||||
: base (cb, state)
|
||||
{
|
||||
this.cb = cb;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public WebAsyncResult (AsyncCallback cb, object state, byte [] buffer, int offset, int size)
|
||||
: base (cb, state)
|
||||
{
|
||||
this.cb = cb;
|
||||
this.state = state;
|
||||
this.buffer = buffer;
|
||||
this.offset = offset;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
internal void SetCompleted (bool synch, Exception e)
|
||||
{
|
||||
this.synch = synch;
|
||||
exc = e;
|
||||
lock (locker) {
|
||||
isCompleted = true;
|
||||
if (handle != null)
|
||||
handle.Set ();
|
||||
}
|
||||
}
|
||||
|
||||
internal void Reset ()
|
||||
{
|
||||
callbackDone = false;
|
||||
exc = null;
|
||||
response = null;
|
||||
writeStream = null;
|
||||
exc = null;
|
||||
lock (locker) {
|
||||
isCompleted = false;
|
||||
if (handle != null)
|
||||
handle.Reset ();
|
||||
}
|
||||
this.nbytes = 0;
|
||||
this.response = null;
|
||||
this.buffer = null;
|
||||
this.offset = 0;
|
||||
this.size = 0;
|
||||
Reset_internal ();
|
||||
}
|
||||
|
||||
internal void SetCompleted (bool synch, int nbytes)
|
||||
{
|
||||
this.synch = synch;
|
||||
this.nbytes = nbytes;
|
||||
exc = null;
|
||||
lock (locker) {
|
||||
isCompleted = true;
|
||||
if (handle != null)
|
||||
handle.Set ();
|
||||
}
|
||||
SetCompleted_internal (synch);
|
||||
}
|
||||
|
||||
internal void SetCompleted (bool synch, Stream writeStream)
|
||||
{
|
||||
this.synch = synch;
|
||||
this.writeStream = writeStream;
|
||||
exc = null;
|
||||
lock (locker) {
|
||||
isCompleted = true;
|
||||
if (handle != null)
|
||||
handle.Set ();
|
||||
}
|
||||
SetCompleted_internal (synch);
|
||||
}
|
||||
|
||||
internal void SetCompleted (bool synch, HttpWebResponse response)
|
||||
{
|
||||
this.synch = synch;
|
||||
this.response = response;
|
||||
exc = null;
|
||||
lock (locker) {
|
||||
isCompleted = true;
|
||||
if (handle != null)
|
||||
handle.Set ();
|
||||
}
|
||||
SetCompleted_internal (synch);
|
||||
}
|
||||
|
||||
|
||||
internal void DoCallback ()
|
||||
{
|
||||
if (!callbackDone && cb != null) {
|
||||
callbackDone = true;
|
||||
if (synch)
|
||||
cb (this);
|
||||
else
|
||||
ThreadPool.QueueUserWorkItem (CB, null);
|
||||
}
|
||||
}
|
||||
|
||||
void CB (object unused)
|
||||
{
|
||||
cb (this);
|
||||
}
|
||||
|
||||
internal void WaitUntilComplete ()
|
||||
{
|
||||
if (IsCompleted)
|
||||
return;
|
||||
|
||||
AsyncWaitHandle.WaitOne ();
|
||||
}
|
||||
|
||||
internal bool WaitUntilComplete (int timeout, bool exitContext)
|
||||
{
|
||||
if (IsCompleted)
|
||||
return true;
|
||||
|
||||
return AsyncWaitHandle.WaitOne (timeout, exitContext);
|
||||
}
|
||||
|
||||
public object AsyncState {
|
||||
get { return state; }
|
||||
}
|
||||
|
||||
public WaitHandle AsyncWaitHandle {
|
||||
get {
|
||||
lock (locker) {
|
||||
if (handle == null)
|
||||
handle = new ManualResetEvent (isCompleted);
|
||||
}
|
||||
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CompletedSynchronously {
|
||||
get { return synch; }
|
||||
}
|
||||
|
||||
public bool IsCompleted {
|
||||
get {
|
||||
lock (locker) {
|
||||
return isCompleted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal bool GotException {
|
||||
get { return (exc != null); }
|
||||
}
|
||||
|
||||
internal Exception Exception {
|
||||
get { return exc; }
|
||||
DoCallback_internal ();
|
||||
}
|
||||
|
||||
internal int NBytes {
|
||||
|
||||
@@ -70,14 +70,16 @@ namespace System.Net
|
||||
//TODO: abort requests or wait for them to finish
|
||||
lock (sPoint) {
|
||||
closing = true;
|
||||
foreach (var cnc in connections) {
|
||||
if (cnc.Connection == null)
|
||||
continue;
|
||||
cnc.Connection.Close (false);
|
||||
cnc.Connection = null;
|
||||
var iter = connections.First;
|
||||
while (iter != null) {
|
||||
var cnc = iter.Value.Connection;
|
||||
var node = iter;
|
||||
iter = iter.Next;
|
||||
|
||||
connections.Remove (node);
|
||||
cnc.Close (false);
|
||||
OnConnectionClosed ();
|
||||
}
|
||||
connections.Clear ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +122,7 @@ namespace System.Net
|
||||
ConnectionState FindIdleConnection ()
|
||||
{
|
||||
foreach (var cnc in connections) {
|
||||
if (cnc.Busy || cnc.Connection == null)
|
||||
if (cnc.Busy)
|
||||
continue;
|
||||
|
||||
connections.Remove (cnc);
|
||||
@@ -140,7 +142,7 @@ namespace System.Net
|
||||
return cnc.Connection;
|
||||
}
|
||||
|
||||
if (sPoint.ConnectionLimit > connections.Count) {
|
||||
if (sPoint.ConnectionLimit > connections.Count || connections.Count == 0) {
|
||||
created = true;
|
||||
cnc = new ConnectionState (this);
|
||||
connections.AddFirst (cnc);
|
||||
@@ -177,14 +179,11 @@ namespace System.Net
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (var node = connections.First; node != null; node = node.Next) {
|
||||
var cnc = node.Value;
|
||||
|
||||
if (cnc.Connection == null) {
|
||||
connections.Remove (node);
|
||||
OnConnectionClosed ();
|
||||
continue;
|
||||
}
|
||||
var iter = connections.First;
|
||||
while (iter != null) {
|
||||
var cnc = iter.Value;
|
||||
var node = iter;
|
||||
iter = iter.Next;
|
||||
|
||||
++count;
|
||||
if (cnc.Busy)
|
||||
@@ -205,7 +204,7 @@ namespace System.Net
|
||||
if (connectionsToClose == null)
|
||||
connectionsToClose = new List<WebConnection> ();
|
||||
connectionsToClose.Add (cnc.Connection);
|
||||
cnc.Connection = null;
|
||||
connections.Remove (node);
|
||||
}
|
||||
|
||||
recycled = connections.Count == 0;
|
||||
@@ -224,7 +223,10 @@ namespace System.Net
|
||||
}
|
||||
|
||||
class ConnectionState : IWebConnectionState {
|
||||
public WebConnection Connection;
|
||||
public WebConnection Connection {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public WebConnectionGroup Group {
|
||||
get;
|
||||
|
||||
@@ -514,6 +514,13 @@ namespace System.Net
|
||||
Buffer.BlockCopy (buffer, offset, newBuffer, head.Length, size);
|
||||
Buffer.BlockCopy (crlf, 0, newBuffer, head.Length + size, crlf.Length);
|
||||
|
||||
if (allowBuffering) {
|
||||
if (writeBuffer == null)
|
||||
writeBuffer = new MemoryStream ();
|
||||
writeBuffer.Write (buffer, offset, size);
|
||||
totalWritten += size;
|
||||
}
|
||||
|
||||
buffer = newBuffer;
|
||||
offset = 0;
|
||||
size = chunkSize;
|
||||
@@ -626,10 +633,15 @@ namespace System.Net
|
||||
{
|
||||
}
|
||||
|
||||
internal WebAsyncResult SetHeadersAsync (bool setInternalLength, AsyncCallback callback, object state)
|
||||
internal SimpleAsyncResult SetHeadersAsync (bool setInternalLength, SimpleAsyncCallback callback)
|
||||
{
|
||||
return SimpleAsyncResult.Run (r => SetHeadersAsync (r, setInternalLength), callback);
|
||||
}
|
||||
|
||||
bool SetHeadersAsync (SimpleAsyncResult result, bool setInternalLength)
|
||||
{
|
||||
if (headersSent)
|
||||
return null;
|
||||
return false;
|
||||
|
||||
string method = request.Method;
|
||||
bool no_writestream = (method == "GET" || method == "CONNECT" || method == "HEAD" ||
|
||||
@@ -641,59 +653,61 @@ namespace System.Net
|
||||
if (setInternalLength && !no_writestream && writeBuffer != null)
|
||||
request.InternalContentLength = writeBuffer.Length;
|
||||
|
||||
if (sendChunked || request.ContentLength > -1 || no_writestream || webdav) {
|
||||
headersSent = true;
|
||||
headers = request.GetRequestHeaders ();
|
||||
if (!(sendChunked || request.ContentLength > -1 || no_writestream || webdav))
|
||||
return false;
|
||||
|
||||
var result = new WebAsyncResult (callback, state);
|
||||
result.InnerAsyncResult = cnc.BeginWrite (request, headers, 0, headers.Length, new AsyncCallback (SetHeadersCB), result);
|
||||
if (result.InnerAsyncResult != null)
|
||||
return result;
|
||||
}
|
||||
headersSent = true;
|
||||
headers = request.GetRequestHeaders ();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
void SetHeadersCB (IAsyncResult r)
|
||||
{
|
||||
WebAsyncResult result = (WebAsyncResult) r.AsyncState;
|
||||
result.InnerAsyncResult = null;
|
||||
try {
|
||||
cnc.EndWrite (request, true, r);
|
||||
result.SetCompleted (false, 0);
|
||||
if (!initRead) {
|
||||
initRead = true;
|
||||
WebConnection.InitRead (cnc);
|
||||
var innerResult = cnc.BeginWrite (request, headers, 0, headers.Length, r => {
|
||||
try {
|
||||
cnc.EndWrite (request, true, r);
|
||||
if (!initRead) {
|
||||
initRead = true;
|
||||
WebConnection.InitRead (cnc);
|
||||
}
|
||||
var cl = request.ContentLength;
|
||||
if (!sendChunked && cl == 0)
|
||||
requestWritten = true;
|
||||
result.SetCompleted (false);
|
||||
} catch (WebException e) {
|
||||
result.SetCompleted (false, e);
|
||||
} catch (Exception e) {
|
||||
result.SetCompleted (false, new WebException ("Error writing headers", e, WebExceptionStatus.SendFailure));
|
||||
}
|
||||
long cl = request.ContentLength;
|
||||
if (!sendChunked && cl == 0)
|
||||
requestWritten = true;
|
||||
} catch (WebException e) {
|
||||
result.SetCompleted (false, e);
|
||||
} catch (Exception e) {
|
||||
result.SetCompleted (false, new WebException ("Error writing headers", e, WebExceptionStatus.SendFailure));
|
||||
}
|
||||
result.DoCallback ();
|
||||
}, null);
|
||||
|
||||
return innerResult != null;
|
||||
}
|
||||
|
||||
internal bool RequestWritten {
|
||||
get { return requestWritten; }
|
||||
}
|
||||
|
||||
internal WebAsyncResult WriteRequestAsync (AsyncCallback callback, object state)
|
||||
internal SimpleAsyncResult WriteRequestAsync (SimpleAsyncCallback callback)
|
||||
{
|
||||
var result = WriteRequestAsync (callback);
|
||||
try {
|
||||
if (!WriteRequestAsync (result))
|
||||
result.SetCompleted (true);
|
||||
} catch (Exception ex) {
|
||||
result.SetCompleted (true, ex);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal bool WriteRequestAsync (SimpleAsyncResult result)
|
||||
{
|
||||
if (requestWritten)
|
||||
return null;
|
||||
return false;
|
||||
|
||||
requestWritten = true;
|
||||
if (sendChunked)
|
||||
return null;
|
||||
if (sendChunked || !allowBuffering || writeBuffer == null)
|
||||
return false;
|
||||
|
||||
if (!allowBuffering || writeBuffer == null)
|
||||
return null;
|
||||
|
||||
byte[] bytes = writeBuffer.GetBuffer ();
|
||||
int length = (int)writeBuffer.Length;
|
||||
// Keep the call for a potential side-effect of GetBuffer
|
||||
var bytes = writeBuffer.GetBuffer ();
|
||||
var length = (int)writeBuffer.Length;
|
||||
if (request.ContentLength != -1 && request.ContentLength < length) {
|
||||
nextReadCalled = true;
|
||||
cnc.Close (true);
|
||||
@@ -701,63 +715,39 @@ namespace System.Net
|
||||
WebExceptionStatus.ServerProtocolViolation, null);
|
||||
}
|
||||
|
||||
var result = new WebAsyncResult (callback, state);
|
||||
result.InnerAsyncResult = SetHeadersAsync (true, WriteRequestAsyncCB, result);
|
||||
if (result.InnerAsyncResult == null)
|
||||
WriteRequestAsyncCB (result);
|
||||
return result;
|
||||
}
|
||||
var ret = SetHeadersAsync (true, inner => {
|
||||
if (inner.GotException) {
|
||||
result.SetCompleted (inner.CompletedSynchronously, inner.Exception);
|
||||
return;
|
||||
}
|
||||
|
||||
void WriteRequestAsyncCB (IAsyncResult ar)
|
||||
{
|
||||
var result = (WebAsyncResult)ar;
|
||||
var innerResult = (WebAsyncResult)result.InnerAsyncResult;
|
||||
result.InnerAsyncResult = null;
|
||||
if (cnc.Data.StatusCode != 0 && cnc.Data.StatusCode != 100) {
|
||||
result.SetCompleted (inner.CompletedSynchronously);
|
||||
return;
|
||||
}
|
||||
|
||||
if (innerResult != null && innerResult.GotException) {
|
||||
result.SetCompleted (false, innerResult.Exception);
|
||||
result.DoCallback ();
|
||||
return;
|
||||
}
|
||||
if (!initRead) {
|
||||
initRead = true;
|
||||
WebConnection.InitRead (cnc);
|
||||
}
|
||||
|
||||
if (cnc.Data.StatusCode != 0 && cnc.Data.StatusCode != 100) {
|
||||
result.SetCompleted (false, 0);
|
||||
result.DoCallback ();
|
||||
return;
|
||||
}
|
||||
if (length == 0) {
|
||||
complete_request_written = true;
|
||||
result.SetCompleted (inner.CompletedSynchronously);
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] bytes = writeBuffer.GetBuffer ();
|
||||
int length = (int)writeBuffer.Length;
|
||||
cnc.BeginWrite (request, bytes, 0, length, r => {
|
||||
try {
|
||||
complete_request_written = cnc.EndWrite (request, false, r);
|
||||
result.SetCompleted (false);
|
||||
} catch (Exception exc) {
|
||||
result.SetCompleted (false, exc);
|
||||
}
|
||||
}, null);
|
||||
});
|
||||
|
||||
if (length > 0)
|
||||
result.InnerAsyncResult = cnc.BeginWrite (request, bytes, 0, length, WriteRequestAsyncCB2, result);
|
||||
|
||||
if (!initRead) {
|
||||
initRead = true;
|
||||
WebConnection.InitRead (cnc);
|
||||
}
|
||||
|
||||
if (length == 0) {
|
||||
result.SetCompleted (false, 0);
|
||||
result.DoCallback ();
|
||||
complete_request_written = true;
|
||||
}
|
||||
}
|
||||
|
||||
void WriteRequestAsyncCB2 (IAsyncResult ar)
|
||||
{
|
||||
var result = (WebAsyncResult)ar.AsyncState;
|
||||
var innerResult = result.InnerAsyncResult;
|
||||
result.InnerAsyncResult = null;
|
||||
|
||||
try {
|
||||
complete_request_written = cnc.EndWrite (request, false, innerResult);
|
||||
result.SetCompleted (false, 0);
|
||||
} catch (Exception exc) {
|
||||
result.SetCompleted (false, exc);
|
||||
} finally {
|
||||
result.DoCallback ();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
internal void InternalClose ()
|
||||
|
||||
@@ -287,16 +287,26 @@ namespace System.Net
|
||||
return GetCreator (requestUri.Scheme).Create (requestUri);
|
||||
}
|
||||
#if NET_4_0
|
||||
[MonoTODO ("for portable library support")]
|
||||
static HttpWebRequest SharedCreateHttp (Uri uri)
|
||||
{
|
||||
if (uri.Scheme != "http" && uri.Scheme != "https")
|
||||
throw new NotSupportedException ("The uri should start with http or https");
|
||||
|
||||
return new HttpWebRequest (uri);
|
||||
}
|
||||
|
||||
public static HttpWebRequest CreateHttp (string requestUriString)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
if (requestUriString == null)
|
||||
throw new ArgumentNullException ("requestUriString");
|
||||
return SharedCreateHttp (new Uri (requestUriString));
|
||||
}
|
||||
|
||||
[MonoTODO ("for portable library support")]
|
||||
public static HttpWebRequest CreateHttp (Uri requestUri)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
if (requestUri == null)
|
||||
throw new ArgumentNullException ("requestUri");
|
||||
return SharedCreateHttp (requestUri);
|
||||
}
|
||||
#endif
|
||||
public virtual Stream EndGetRequestStream (IAsyncResult asyncResult)
|
||||
|
||||
@@ -86,9 +86,13 @@ namespace System.Net
|
||||
get { throw new NotSupportedException (); }
|
||||
}
|
||||
#if NET_4_0
|
||||
[MonoTODO ("for portable library support")]
|
||||
|
||||
public virtual bool SupportsHeaders {
|
||||
get { throw new NotImplementedException (); }
|
||||
get {
|
||||
// The managed stack always returns this as true, it is only
|
||||
// the Silverlight stack that does not support this.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// Methods
|
||||
|
||||
@@ -834,6 +834,7 @@ System.Net.Security/SslPolicyErrors.cs
|
||||
System.Net/ServicePoint.cs
|
||||
System.Net/ServicePointManager.cs
|
||||
System.Net/ServicePointManager.extra.cs
|
||||
System.Net/SimpleAsyncResult.cs
|
||||
System.Net/SocketAddress.cs
|
||||
System.Net/SocketPermissionAttribute.cs
|
||||
System.Net/SocketPermission.cs
|
||||
|
||||
@@ -526,6 +526,7 @@ System.Net/SecurityProtocolType.cs
|
||||
System.Net/ServicePoint.cs
|
||||
System.Net/ServicePointManager.cs
|
||||
System.Net/ServicePointManager.extra.cs
|
||||
System.Net/SimpleAsyncResult.cs
|
||||
System.Net/SocketAddress.cs
|
||||
System.Net/TransportContext.cs
|
||||
System.Net/TransportType.cs
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#include monotouch_System.dll.sources
|
||||
@@ -775,6 +775,7 @@ namespace System
|
||||
[ThreadStatic]
|
||||
static NumberFormatter threadNumberFormatter;
|
||||
|
||||
[ThreadStatic]
|
||||
static NumberFormatter userFormatProvider;
|
||||
|
||||
private static NumberFormatter GetInstance (IFormatProvider fp)
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using System.Text;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
@@ -4377,5 +4378,31 @@ namespace MonoTests.System
|
||||
Assert.AreEqual ("n 0001.13'", (-1.1345343).ToString (formatString, CultureInfo.InvariantCulture), "#2");
|
||||
Assert.AreEqual ("0'", 0.0.ToString (formatString, CultureInfo.InvariantCulture), "#3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInvariantThreading ()
|
||||
{
|
||||
Thread[] th = new Thread[4];
|
||||
bool failed = false;
|
||||
|
||||
for (int i = 0; i < th.Length; i++) {
|
||||
th [i] = new Thread (() => {
|
||||
for (int ii = 0; ii < 100; ++ii) {
|
||||
var headers = new StringBuilder ();
|
||||
headers.AppendFormat (CultureInfo.InvariantCulture, "{0} {1}", 100, "ok");
|
||||
if (headers.ToString () != "100 ok") {
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
th [i].Start ();
|
||||
}
|
||||
|
||||
foreach (Thread t in th) {
|
||||
t.Join ();
|
||||
}
|
||||
|
||||
Assert.IsFalse (failed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,9 @@ namespace Microsoft.Scripting.Interpreter {
|
||||
return GetArrayAccessor(info, argumentCount);
|
||||
}
|
||||
|
||||
#if FULL_AOT_RUNTIME
|
||||
return new MethodInfoCallInstruction(info, argumentCount);
|
||||
#else
|
||||
if (ReflectionUtils.IsDynamicMethod(info) || !info.IsStatic && info.DeclaringType.IsValueType()) {
|
||||
return new MethodInfoCallInstruction(info, argumentCount);
|
||||
}
|
||||
@@ -109,7 +112,8 @@ namespace Microsoft.Scripting.Interpreter {
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
|
||||
private static CallInstruction GetArrayAccessor(MethodInfo info, int argumentCount) {
|
||||
|
||||
+3
-6
@@ -35,16 +35,13 @@ using Microsoft.Scripting.Runtime;
|
||||
using Microsoft.Scripting.Utils;
|
||||
|
||||
namespace Microsoft.Scripting.Interpreter {
|
||||
abstract class ConstantInstruction : Instruction {
|
||||
sealed class PushValueInstruction : Instruction {
|
||||
object value;
|
||||
|
||||
public override int ConsumedStack { get { return 0; } }
|
||||
public override int ProducedStack { get { return 1; } }
|
||||
}
|
||||
|
||||
sealed class PushIntegerValueInstruction : ConstantInstruction {
|
||||
int value;
|
||||
|
||||
public PushIntegerValueInstruction (int value)
|
||||
public PushValueInstruction (object value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -365,6 +365,10 @@ namespace Microsoft.Scripting.Interpreter {
|
||||
Emit(PopInstruction.Instance);
|
||||
}
|
||||
|
||||
public void EmitStore(object value) {
|
||||
Emit (new PushValueInstruction (value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Locals
|
||||
@@ -665,7 +669,7 @@ namespace Microsoft.Scripting.Interpreter {
|
||||
#endregion
|
||||
|
||||
public void EmitIncrement (Type type) {
|
||||
Emit (new PushIntegerValueInstruction (1));
|
||||
Emit (new PushValueInstruction (1));
|
||||
EmitAdd (type, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1478,6 +1478,10 @@ namespace Microsoft.Scripting.Interpreter {
|
||||
_instructions.EmitCreateDelegate(creator);
|
||||
}
|
||||
|
||||
private void CompileQuotedLambdaExpression(Expression expr) {
|
||||
_instructions.EmitStore (expr);
|
||||
}
|
||||
|
||||
private void CompileCoalesceBinaryExpression(Expression expr) {
|
||||
var node = (BinaryExpression)expr;
|
||||
|
||||
@@ -1531,9 +1535,9 @@ namespace Microsoft.Scripting.Interpreter {
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "expr")]
|
||||
private void CompileQuoteUnaryExpression(Expression expr) {
|
||||
throw new System.NotImplementedException();
|
||||
private void CompileQuoteUnaryExpression(Expression expr) {
|
||||
var qe = (UnaryExpression)expr;
|
||||
CompileQuotedLambdaExpression (qe.Operand);
|
||||
}
|
||||
|
||||
private void CompileUnboxUnaryExpression(Expression expr) {
|
||||
|
||||
@@ -1267,7 +1267,7 @@ namespace Mono.CSharp {
|
||||
throw new InternalErrorException (e, loc);
|
||||
}
|
||||
|
||||
if (!ec.IsInProbingMode) {
|
||||
if (!ec.IsInProbingMode && !etree_conversion) {
|
||||
compatibles.Add (type, am ?? EmptyExpression.Null);
|
||||
}
|
||||
|
||||
@@ -1599,6 +1599,7 @@ namespace Mono.CSharp {
|
||||
var da_ontrue = fc.DefiniteAssignmentOnTrue;
|
||||
var da_onfalse = fc.DefiniteAssignmentOnFalse;
|
||||
|
||||
fc.DefiniteAssignmentOnTrue = fc.DefiniteAssignmentOnFalse = null;
|
||||
block.FlowAnalysis (fc);
|
||||
|
||||
fc.ParametersBlock = prev_pb;
|
||||
|
||||
+8
-2
@@ -334,7 +334,7 @@ namespace Mono.CSharp {
|
||||
|
||||
if (source == null) {
|
||||
ok = false;
|
||||
source = EmptyExpression.Null;
|
||||
source = ErrorExpression.Instance;
|
||||
}
|
||||
|
||||
target = target.ResolveLValue (ec, source);
|
||||
@@ -589,6 +589,12 @@ namespace Mono.CSharp {
|
||||
|
||||
public int AssignmentOffset { get; private set; }
|
||||
|
||||
public FieldBase Field {
|
||||
get {
|
||||
return mc;
|
||||
}
|
||||
}
|
||||
|
||||
public override Location StartLocation {
|
||||
get {
|
||||
return loc;
|
||||
@@ -601,8 +607,8 @@ namespace Mono.CSharp {
|
||||
if (source == null)
|
||||
return null;
|
||||
|
||||
var bc = (BlockContext) rc;
|
||||
if (resolved == null) {
|
||||
var bc = (BlockContext) rc;
|
||||
var ctx = new FieldInitializerContext (mc, bc);
|
||||
resolved = base.DoResolve (ctx) as ExpressionStatement;
|
||||
AssignmentOffset = ctx.AssignmentInfoOffset - bc.AssignmentInfoOffset;
|
||||
|
||||
+13
-1
@@ -1010,9 +1010,20 @@ namespace Mono.CSharp
|
||||
|
||||
for (int i = 0; i < initialized_fields.Count; ++i) {
|
||||
FieldInitializer fi = initialized_fields [i];
|
||||
|
||||
//
|
||||
// Clone before resolving otherwise when field initializer is needed
|
||||
// in more than 1 constructor any resolve after the initial one would
|
||||
// only took the resolved expression which is problem for expressions
|
||||
// that generate extra expressions or code during Resolve phase
|
||||
//
|
||||
var cloned = fi.Clone (new CloneContext ());
|
||||
|
||||
ExpressionStatement s = fi.ResolveStatement (ec);
|
||||
if (s == null)
|
||||
if (s == null) {
|
||||
initialized_fields [i] = new FieldInitializer (fi.Field, ErrorExpression.Instance, Location.Null);
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Field is re-initialized to its default value => removed
|
||||
@@ -1022,6 +1033,7 @@ namespace Mono.CSharp
|
||||
|
||||
ec.AssignmentInfoOffset += fi.AssignmentOffset;
|
||||
ec.CurrentBlock.AddScopeStatement (new StatementExpression (s));
|
||||
initialized_fields [i] = (FieldInitializer) cloned;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1467,6 +1467,7 @@ namespace Mono.CSharp {
|
||||
return e;
|
||||
|
||||
source.Error_ValueCannotBeConverted (ec, target_type, false);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -5792,6 +5792,14 @@ namespace Mono.CSharp {
|
||||
}
|
||||
}
|
||||
|
||||
protected override void CloneTo (CloneContext clonectx, Expression target)
|
||||
{
|
||||
var t = (FieldExpr) target;
|
||||
|
||||
if (InstanceExpression != null)
|
||||
t.InstanceExpression = InstanceExpression.Clone (clonectx);
|
||||
}
|
||||
|
||||
public override Expression CreateExpressionTree (ResolveContext ec)
|
||||
{
|
||||
return CreateExpressionTree (ec, true);
|
||||
|
||||
@@ -9999,6 +9999,10 @@ namespace Mono.CSharp
|
||||
loc = Location.Null;
|
||||
}
|
||||
|
||||
protected override void CloneTo (CloneContext clonectx, Expression target)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool ContainsEmitWithAwait ()
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
public sealed class C
|
||||
{
|
||||
public C ()
|
||||
{
|
||||
}
|
||||
|
||||
public C (Action<object, object> tappedCallback)
|
||||
{
|
||||
}
|
||||
|
||||
public readonly string TappedCallbackProperty = Create<C, Action<object, object>> (o => o.TappedCallback);
|
||||
|
||||
public Action<object, object> TappedCallback {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public static string Create<T1, T2> (Expression<Func<T1, T2>> getter)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void Main ()
|
||||
{
|
||||
new C (null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main ()
|
||||
{
|
||||
SomeMethod ();
|
||||
}
|
||||
|
||||
private static bool SomeMethod ()
|
||||
{
|
||||
int m;
|
||||
int n = 2;
|
||||
bool b_const = true;
|
||||
|
||||
bool b = F (() => F1 (n, out m) && Ferror (m)) && b_const;
|
||||
return b;
|
||||
}
|
||||
|
||||
protected static bool F (Func<bool> rule)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool F1 (int j, out int m)
|
||||
{
|
||||
m = 2;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool Ferror (int i)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool Fouter ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,7 @@ EXTRA_DISTFILES = \
|
||||
frameworks/net_4.5.xml \
|
||||
targets/Microsoft.Portable.CSharp_4.0.targets \
|
||||
targets/Microsoft.Portable.CSharp_4.5.targets \
|
||||
targets/Microsoft.Portable.Common.targets \
|
||||
targets/Microsoft.Portable.Core.targets \
|
||||
targets/Microsoft.Portable.Core.props \
|
||||
targets/Microsoft.WebApplication.targets \
|
||||
|
||||
+1070
-1072
File diff suppressed because it is too large.
Load diff
@@ -219,7 +219,7 @@ output_char (FILE *f, char c) {
|
||||
if (isalnum (c))
|
||||
fprintf (f, "%c", c);
|
||||
else
|
||||
fprintf (f, "\\x%x\" \"", c);
|
||||
fprintf (f, "\\x%x\" \"", (guint8)c);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -9520,10 +9520,12 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
|
||||
addr = emit_get_rgctx_gsharedvt_call (cfg, context_used, fsig, cmethod, MONO_RGCTX_INFO_METHOD_GSHAREDVT_OUT_TRAMPOLINE);
|
||||
mono_emit_calli (cfg, fsig, sp, addr, NULL, vtable_arg);
|
||||
} else if (context_used &&
|
||||
(!mono_method_is_generic_sharable (cmethod, TRUE) ||
|
||||
!mono_class_generic_sharing_enabled (cmethod->klass))) {
|
||||
((!mono_method_is_generic_sharable (cmethod, TRUE) ||
|
||||
!mono_class_generic_sharing_enabled (cmethod->klass)) || cfg->gsharedvt)) {
|
||||
MonoInst *cmethod_addr;
|
||||
|
||||
/* Generic calls made out of gsharedvt methods cannot be patched, so use an indirect call */
|
||||
|
||||
cmethod_addr = emit_get_rgctx_method (cfg, context_used,
|
||||
cmethod, MONO_RGCTX_INFO_GENERIC_METHOD_CODE);
|
||||
|
||||
|
||||
@@ -64,9 +64,13 @@ mono_dead_letter_dealloc (id self, SEL _cmd)
|
||||
void
|
||||
mono_threads_install_dead_letter (void)
|
||||
{
|
||||
id cur = objc_msgSend ((id)nsthread, currentThread);
|
||||
id dict = objc_msgSend (cur, threadDictionary);
|
||||
if (objc_msgSend (dict, objectForKey, mono_dead_letter_key) == nil) {
|
||||
id cur, dict;
|
||||
|
||||
cur = objc_msgSend ((id)nsthread, currentThread);
|
||||
if (!cur)
|
||||
return;
|
||||
dict = objc_msgSend (cur, threadDictionary);
|
||||
if (dict && objc_msgSend (dict, objectForKey, mono_dead_letter_key) == nil) {
|
||||
id value = objc_msgSend (objc_msgSend ((id)mono_dead_letter_class, alloc), init);
|
||||
objc_msgSend (dict, setObjectForKey, value, mono_dead_letter_key);
|
||||
objc_msgSend (value, release);
|
||||
|
||||
@@ -1117,9 +1117,12 @@ namespace Mono.Tools.LocaleBuilder
|
||||
if (el != null) {
|
||||
// CLDR uses unicode negative sign for some culture (e.g sv, is, lt, don't kwnow why) but .net always
|
||||
// uses simple - sign
|
||||
if (el.InnerText == "\u2212")
|
||||
if (el.InnerText == "\u2212") {
|
||||
ni.NegativeSign = "-";
|
||||
else
|
||||
} else if (el.InnerText == "\u200F\u002D") {
|
||||
// Remove any right-to-left mark characters
|
||||
ni.NegativeSign = "-";
|
||||
} else
|
||||
ni.NegativeSign = el.InnerText;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user