diff options
| author | Michalis Adamidis <gsnerf@gsnerf.de> | 2014-08-24 19:53:53 +0200 |
|---|---|---|
| committer | Michalis Adamidis <gsnerf@gsnerf.de> | 2014-08-24 19:53:53 +0200 |
| commit | 5740a4c22d676d0050e875b0bd5455f5a303f5bd (patch) | |
| tree | 8cbdc9a742be677fd96b1be32bb74a294d8722c4 /MediaBrowser.ServerApplication/EntryPoints | |
| parent | 7b8050ed382e1e39399c6d1b06637cd07ac6b8d5 (diff) | |
| parent | 58a38d0d1ddb89439b763e7bc50e8b84105f68fe (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Conflicts:
MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj
Diffstat (limited to 'MediaBrowser.ServerApplication/EntryPoints')
| -rw-r--r-- | MediaBrowser.ServerApplication/EntryPoints/WanAddressEntryPoint.cs | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/MediaBrowser.ServerApplication/EntryPoints/WanAddressEntryPoint.cs b/MediaBrowser.ServerApplication/EntryPoints/WanAddressEntryPoint.cs deleted file mode 100644 index 7b2a1314e0..0000000000 --- a/MediaBrowser.ServerApplication/EntryPoints/WanAddressEntryPoint.cs +++ /dev/null @@ -1,55 +0,0 @@ -using MediaBrowser.Common.Net; -using MediaBrowser.Controller.Plugins; -using System; -using System.IO; -using System.Threading; - -namespace MediaBrowser.ServerApplication.EntryPoints -{ - public class WanAddressEntryPoint : IServerEntryPoint - { - public static string WanAddress; - private Timer _timer; - private readonly IHttpClient _httpClient; - - public WanAddressEntryPoint(IHttpClient httpClient) - { - _httpClient = httpClient; - } - - public void Run() - { - _timer = new Timer(TimerCallback, null, TimeSpan.FromMinutes(1), TimeSpan.FromHours(24)); - } - - private async void TimerCallback(object state) - { - try - { - using (var stream = await _httpClient.Get(new HttpRequestOptions - { - Url = "http://bot.whatismyipaddress.com/" - - }).ConfigureAwait(false)) - { - using (var reader = new StreamReader(stream)) - { - WanAddress = await reader.ReadToEndAsync().ConfigureAwait(false); - } - } - } - catch - { - } - } - - public void Dispose() - { - if (_timer != null) - { - _timer.Dispose(); - _timer = null; - } - } - } -} |
