diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2012-11-11 21:52:26 +0000 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2012-11-11 21:52:26 +0000 |
commit | dd672e2c4d0dcf73a30be3d8f7fc2ec38cb6450e (patch) | |
tree | c86fb7b4c7ef5a100bf9f904ac384a0dc41b02ea /protocols/twitter/twitter_lib.c | |
parent | 2fb1262a8200ec05d1b3334103fb7182dc2b2fa7 (diff) |
Detect and handle streaming connection loss.
Diffstat (limited to 'protocols/twitter/twitter_lib.c')
-rw-r--r-- | protocols/twitter/twitter_lib.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index ee19786a..d7e54392 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -731,6 +731,7 @@ static gboolean twitter_stream_handle_object(struct im_connection *ic, json_valu static void twitter_http_stream(struct http_request *req) { struct im_connection *ic = req->data; + struct twitter_data *td; json_value *parsed; int len = 0; char c, *nl; @@ -738,6 +739,15 @@ static void twitter_http_stream(struct http_request *req) if (!g_slist_find(twitter_connections, ic)) return; + td = ic->proto_data; + + if ((req->flags & HTTPC_EOF) || !req->reply_body) { + td->stream = NULL; + imcb_error(ic, "Stream closed (%s)", req->status_string); + imc_logout(ic, TRUE); + return; + } + printf( "%d bytes in stream\n", req->body_size ); /* MUST search for CRLF, not just LF: |