[Tween-svn] [1545] UserStreamの接続に失敗した場合に再起動するまでUserStream受信ができなくなるのを修正

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 5月 29日 (日) 19:23:55 JST


Revision: 1545
          http://sourceforge.jp/projects/tween/svn/view?view=rev&revision=1545
Author:   syo68k
Date:     2011-05-29 19:23:55 +0900 (Sun, 29 May 2011)

Log Message:
-----------
UserStreamの接続に失敗した場合に再起動するまでUserStream受信ができなくなるのを修正

Modified Paths:
--------------
    trunk/Tween/Twitter.vb


-------------- next part --------------
Modified: trunk/Tween/Twitter.vb
===================================================================
--- trunk/Tween/Twitter.vb	2011-05-29 06:42:51 UTC (rev 1544)
+++ trunk/Tween/Twitter.vb	2011-05-29 10:23:55 UTC (rev 1545)
@@ -3274,8 +3274,22 @@
                     End If
 
                     RaiseEvent Started()
+                    Dim res As HttpStatusCode = twCon.UserStream(st, _allAtreplies, _trackwords, My.Application.Info.ProductName + " v" + fileVersion)
 
-                    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
+
                     sr = New StreamReader(st)
 
                     Do While _streamActive AndAlso Not sr.EndOfStream



Tween-svn メーリングリストの案内
Back to archive index