OSDN Git Service

画像アップロード時のタイムアウト秒数をSettingCommonで変更可能にする
authorKimura Youichi <kim.upsilon@bucyou.net>
Sun, 6 Nov 2016 01:03:26 +0000 (10:03 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Fri, 11 Nov 2016 15:12:31 +0000 (00:12 +0900)
OpenTween/Connection/Imgur.cs
OpenTween/Connection/Mobypicture.cs
OpenTween/Connection/Networking.cs
OpenTween/Connection/TwipplePhoto.cs
OpenTween/Connection/TwitterApiConnection.cs
OpenTween/Connection/imgly.cs
OpenTween/Connection/yfrog.cs
OpenTween/Setting/SettingCommon.cs
OpenTween/Tween.cs

index 127c601..f29abdf 100644 (file)
@@ -159,7 +159,7 @@ namespace OpenTween.Connection
             public ImgurApi()
             {
                 this.http = Networking.CreateHttpClient(Networking.CreateHttpClientHandler());
-                this.http.Timeout = TimeSpan.FromMinutes(1);
+                this.http.Timeout = Networking.UploadImageTimeout;
             }
 
             public async Task<XDocument> UploadFileAsync(IMediaItem item, string title)
index 026d8f0..60a2fd3 100644 (file)
@@ -178,7 +178,7 @@ namespace OpenTween.Connection
                 var handler = twitterApi.CreateOAuthEchoHandler(AuthServiceProvider, OAuthRealm);
 
                 this.http = Networking.CreateHttpClient(handler);
-                this.http.Timeout = TimeSpan.FromMinutes(1);
+                this.http.Timeout = Networking.UploadImageTimeout;
             }
 
             /// <summary>
index 51aafd3..830bf42 100644 (file)
@@ -35,6 +35,7 @@ namespace OpenTween.Connection
     public static class Networking
     {
         public static TimeSpan DefaultTimeout { get; set; }
+        public static TimeSpan UploadImageTimeout { get; set; }
 
         /// <summary>
         /// 通信に使用するプロキシの種類
@@ -93,6 +94,7 @@ namespace OpenTween.Connection
         static Networking()
         {
             DefaultTimeout = TimeSpan.FromSeconds(20);
+            UploadImageTimeout = TimeSpan.FromSeconds(60);
             globalHttpClient = CreateHttpClient(new HttpClientHandler());
         }
 
index 34ce7a8..e36be2a 100644 (file)
@@ -157,7 +157,7 @@ namespace OpenTween.Connection
                 var handler = twitterApi.CreateOAuthEchoHandler(AuthServiceProvider, OAuthRealm);
 
                 this.http = Networking.CreateHttpClient(handler);
-                this.http.Timeout = TimeSpan.FromMinutes(1);
+                this.http.Timeout = Networking.UploadImageTimeout;
             }
 
             /// <summary>
index c08d1d2..56f0a1a 100644 (file)
@@ -70,7 +70,7 @@ namespace OpenTween.Connection
             this.http = InitializeHttpClient(this.AccessToken, this.AccessSecret);
 
             this.httpUpload = InitializeHttpClient(this.AccessToken, this.AccessSecret);
-            this.httpUpload.Timeout = TimeSpan.FromMinutes(1);
+            this.httpUpload.Timeout = Networking.UploadImageTimeout;
 
             this.httpStreaming = InitializeHttpClient(this.AccessToken, this.AccessSecret, disableGzip: true);
             this.httpStreaming.Timeout = Timeout.InfiniteTimeSpan;
index 56afe20..e5ff047 100644 (file)
@@ -148,7 +148,7 @@ namespace OpenTween.Connection
                 var handler = twitterApi.CreateOAuthEchoHandler(AuthServiceProvider, OAuthRealm);
 
                 this.http = Networking.CreateHttpClient(handler);
-                this.http.Timeout = TimeSpan.FromMinutes(1);
+                this.http.Timeout = Networking.UploadImageTimeout;
             }
 
             /// <summary>
index 596c45f..f457c0b 100644 (file)
@@ -140,7 +140,7 @@ namespace OpenTween.Connection
                 var handler = twitterApi.CreateOAuthEchoHandler(AuthServiceProvider, OAuthRealm);
 
                 this.http = Networking.CreateHttpClient(handler);
-                this.http.Timeout = TimeSpan.FromMinutes(1);
+                this.http.Timeout = Networking.UploadImageTimeout;
             }
 
             /// <summary>
index d61461d..1a38d49 100644 (file)
@@ -190,6 +190,10 @@ namespace OpenTween
         public bool UseUnreadStyle = true;
         public string DateTimeFormat = "yyyy/MM/dd H:mm:ss";
         public int DefaultTimeOut = 20;
+
+        /// <summary>画像アップロードのタイムアウト設定 (秒)</summary>
+        public int UploadImageTimeout { get; set; } = 60;
+
         public bool RetweetNoConfirm = false;
         public bool LimitBalloon = false;
         public bool TabIconDisp = true;
index 1089ffc..89574f8 100644 (file)
@@ -805,6 +805,7 @@ namespace OpenTween
 
             //Twitter用通信クラス初期化
             Networking.DefaultTimeout = TimeSpan.FromSeconds(this._cfgCommon.DefaultTimeOut);
+            Networking.UploadImageTimeout = TimeSpan.FromSeconds(this._cfgCommon.UploadImageTimeout);
             Networking.SetWebProxy(this._cfgLocal.ProxyType,
                 this._cfgLocal.ProxyAddress, this._cfgLocal.ProxyPort,
                 this._cfgLocal.ProxyUser, this._cfgLocal.ProxyPassword);