aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2016-09-24 23:21:59 -0300
committerdequis <dx@dxzone.com.ar>2016-09-24 23:21:59 -0300
commit985d66d3f99046583175fe44e125e54b666f3c51 (patch)
tree4b195658c2ac3a2659fc381d7f7912a93669c565
parent524e931bb1a61dd7efa44faeb050e41bfc231610 (diff)
twitter: don't count filter stream reply as valid pongs
Twitter streams send newlines to indicate that they are alive. The twitter_http_stream() function processes those and sets the ponged flag so that the whole connection doesn't timeout. That function is used to handle both user stream and filter stream. If the user stream is dead (not sending whitespace) but the filter stream isn't, the latter keeps the connection alive while the main twitter channel is completely dead. This commit only sets the ponged flag for the user stream. This has the side effect of not detecting if the filter stream dies - but that didn't work before, anyway. In the future the whole stream connection management should be revamped - for example stream disconnections shouldn't take the whole account down, especially not filter streams.
-rw-r--r--protocols/twitter/twitter_lib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c
index f1274952..ad019e1d 100644
--- a/protocols/twitter/twitter_lib.c
+++ b/protocols/twitter/twitter_lib.c
@@ -1018,7 +1018,6 @@ static void twitter_http_stream(struct http_request *req)
return;
}
- ic->flags |= OPT_PONGED;
td = ic->proto_data;
if ((req->flags & HTTPC_EOF) || !req->reply_body) {
@@ -1036,6 +1035,10 @@ static void twitter_http_stream(struct http_request *req)
return;
}
+ if (req == td->stream) {
+ ic->flags |= OPT_PONGED;
+ }
+
/* MUST search for CRLF, not just LF:
https://dev.twitter.com/docs/streaming-apis/processing#Parsing_responses */
if (!(nl = strstr(req->reply_body, "\r\n"))) {