Updated reactive extensions usage to reflect new changes
This commit is contained in:
parent
1e61debf2d
commit
a201eb060b
|
@ -81,7 +81,6 @@
|
|||
<Compile Include="Net\Handlers\BaseJsonHandler.cs" />
|
||||
<Compile Include="Net\HttpServer.cs" />
|
||||
<Compile Include="Net\Request.cs" />
|
||||
<Compile Include="Net\StreamExtensions.cs" />
|
||||
<Compile Include="Plugins\BasePlugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Serialization\XmlSerializer.cs" />
|
||||
|
|
|
@ -20,8 +20,7 @@ namespace MediaBrowser.Common.Net
|
|||
private IObservable<HttpListenerContext> ObservableHttpContext()
|
||||
{
|
||||
return Observable.Create<HttpListenerContext>(obs =>
|
||||
Observable.FromAsyncPattern<HttpListenerContext>(listener.BeginGetContext,
|
||||
listener.EndGetContext)()
|
||||
Observable.FromAsync<HttpListenerContext>(() => listener.GetContextAsync())
|
||||
.Subscribe(obs))
|
||||
.Repeat()
|
||||
.Retry()
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Reactive.Linq;
|
||||
|
||||
namespace MediaBrowser.Common.Net
|
||||
{
|
||||
public static class StreamExtensions
|
||||
{
|
||||
public static IObservable<byte[]> ReadBytes(this Stream stream, int count)
|
||||
{
|
||||
var buffer = new byte[count];
|
||||
return Observable.FromAsyncPattern((cb, state) => stream.BeginRead(buffer, 0, count, cb, state), ar =>
|
||||
{
|
||||
stream.EndRead(ar);
|
||||
return buffer;
|
||||
})();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user