Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/Foundation/NSUrlSessionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1413,21 +1413,26 @@ public WrappedNSInputStream (Stream inputStream)
status = NSStreamStatus.NotOpen;
stream = inputStream;
source = new CFRunLoopSource (Handle, false);
IsDirectBinding = false;
}

[Preserve (Conditional = true)]
public override NSStreamStatus Status => status;

[Preserve (Conditional = true)]
public override void Open ()
{
status = NSStreamStatus.Open;
Notify (CFStreamEventType.OpenCompleted);
}

[Preserve (Conditional = true)]
public override void Close ()
{
status = NSStreamStatus.Closed;
}

[Preserve (Conditional = true)]
public override nint Read (IntPtr buffer, nuint len)
{
var sourceBytes = new byte [len];
Expand All @@ -1447,34 +1452,40 @@ public override nint Read (IntPtr buffer, nuint len)
return read;
}

[Preserve (Conditional = true)]
public override bool HasBytesAvailable ()
{
return true;
}

[Preserve (Conditional = true)]
protected override bool GetBuffer (out IntPtr buffer, out nuint len)
{
// Just call the base implemention (which will return false)
return base.GetBuffer (out buffer, out len);
}

// NSInvalidArgumentException Reason: *** -propertyForKey: only defined for abstract class. Define -[System_Net_Http_NSUrlSessionHandler_WrappedNSInputStream propertyForKey:]!
[Preserve (Conditional = true)]
protected override NSObject? GetProperty (NSString key)
{
return null;
}

[Preserve (Conditional = true)]
protected override bool SetProperty (NSObject? property, NSString key)
{
return false;
}

[Preserve (Conditional = true)]
protected override bool SetCFClientFlags (CFStreamEventType inFlags, IntPtr inCallback, IntPtr inContextPtr)
{
// Just call the base implementation, which knows how to handle everything.
return base.SetCFClientFlags (inFlags, inCallback, inContextPtr);
}

[Preserve (Conditional = true)]
#if NET
public override void Schedule (NSRunLoop aRunLoop, NSString nsMode)
#else
Expand All @@ -1496,6 +1507,7 @@ public override void Schedule (NSRunLoop aRunLoop, string mode)
notifying = false;
}

[Preserve (Conditional = true)]
#if NET
public override void Unschedule (NSRunLoop aRunLoop, NSString nsMode)
#else
Expand Down