Imported Upstream version 5.8.0.22

Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-10-19 20:04:20 +00:00
parent 5f4a27cc8a
commit 7d05485754
5020 changed files with 114082 additions and 186061 deletions

View File

@ -300,7 +300,7 @@ namespace Mono.Btls
throw new NotImplementedException ();
}
public override int Read (byte[] buffer, int offset, int size, out bool wantMore)
public override (int ret, bool wantMore) Read (byte[] buffer, int offset, int size)
{
Debug ("Read: {0} {1} {2}", buffer.Length, offset, size);
@ -313,27 +313,23 @@ namespace Mono.Btls
var status = ssl.Read (data, ref size);
Debug ("Read done: {0} {1}", status, size);
if (status == MonoBtlsSslError.WantRead) {
wantMore = true;
return 0;
} else if (status == MonoBtlsSslError.ZeroReturn) {
wantMore = false;
return size;
} else if (status != MonoBtlsSslError.None) {
if (status == MonoBtlsSslError.WantRead)
return (0, true);
if (status == MonoBtlsSslError.ZeroReturn)
return (size, false);
if (status != MonoBtlsSslError.None)
throw GetException (status);
}
if (size > 0)
Marshal.Copy (data, buffer, offset, size);
wantMore = false;
return size;
return (size, false);
} finally {
Marshal.FreeHGlobal (data);
}
}
public override int Write (byte[] buffer, int offset, int size, out bool wantMore)
public override (int ret, bool wantMore) Write (byte[] buffer, int offset, int size)
{
Debug ("Write: {0} {1} {2}", buffer.Length, offset, size);
@ -347,15 +343,12 @@ namespace Mono.Btls
var status = ssl.Write (data, ref size);
Debug ("Write done: {0} {1}", status, size);
if (status == MonoBtlsSslError.WantWrite) {
wantMore = true;
return 0;
} else if (status != MonoBtlsSslError.None) {
if (status == MonoBtlsSslError.WantWrite)
return (0, true);
if (status != MonoBtlsSslError.None)
throw GetException (status);
}
wantMore = false;
return size;
return (size, false);
} finally {
Marshal.FreeHGlobal (data);
}
@ -364,7 +357,8 @@ namespace Mono.Btls
public override void Shutdown ()
{
Debug ("Shutdown!");
// ssl.SetQuietShutdown ();
if (Settings == null || !Settings.SendCloseNotify)
ssl.SetQuietShutdown ();
ssl.Shutdown ();
}