mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 18:14:42 +01:00
Updated reactive extensions usage to reflect new changes
This commit is contained in:
parent
1e61debf2d
commit
a201eb060b
@@ -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;
|
||||
})();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user