OSDN Git Service

UserStreamの接続に失敗した場合に再起動するまでUserStream受信ができなくなるのを修正
authorsyo68k <syo68k@users.sourceforge.jp>
Sun, 29 May 2011 10:23:55 +0000 (19:23 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Sat, 18 Feb 2012 14:19:37 +0000 (23:19 +0900)
Tween/Twitter.vb

index 88bb83f..6fa2d62 100644 (file)
@@ -3274,8 +3274,22 @@ Public Class Twitter
                     End If
 
                     RaiseEvent Started()
+                    Dim res As HttpStatusCode = twCon.UserStream(st, _allAtreplies, _trackwords, My.Application.Info.ProductName + " v" + fileVersion)
+
+                    Select Case res
+                        Case HttpStatusCode.OK
+                            Twitter.AccountState = ACCOUNT_STATE.Valid
+                        Case HttpStatusCode.Unauthorized
+                            Twitter.AccountState = ACCOUNT_STATE.Invalid
+                    End Select
+
+                    If st Is Nothing Then
+                        RaiseEvent Stopped()
+                        'TraceOut("Stop:stream is Nothing")
+                        Thread.Sleep(10 * 1000)
+                        Continue Do
+                    End If
 
-                    twCon.UserStream(st, _allAtreplies, _trackwords, My.Application.Info.ProductName + " v" + fileVersion)
                     sr = New StreamReader(st)
 
                     Do While _streamActive AndAlso Not sr.EndOfStream