Changeset 90fc864


Ignore:
Timestamp:
2011-11-24T08:18:04Z (12 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
693ff09, e4fc493
Parents:
c945ee3
Message:

Hopefully this fixed #838. Patch from Artem Savkov, thanks! The problem was
HTTP failures caused by (most likely) DNS resolution problems. Yes, ignoring
return values is still bad, kids!

Location:
protocols/twitter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter.h

    rc945ee3 r90fc864  
    3939        TWITTER_GOT_TIMELINE = 0x20000,
    4040        TWITTER_GOT_MENTIONS = 0x40000,
    41         TWITTER_DOING_TIMELINE_SLOW = 0x80000,
    4241} twitter_flags_t;
    4342
  • protocols/twitter/twitter_lib.c

    rc945ee3 r90fc864  
    727727        gboolean include_mentions = set_getbool(&ic->acc->set, "fetch_mentions");
    728728
    729         if ((td->flags & 0xf0000) == (TWITTER_DOING_TIMELINE | TWITTER_DOING_TIMELINE_SLOW)) {
    730                 imcb_log(ic, "Connection seems to have stalled again.\n"
    731                              "This is a known bug, if you see this happen a lot "
    732                              "please generate some traffic dumps.");
    733                 td->flags &= ~0xf0000;
    734         }
    735 
    736729        if (td->flags & TWITTER_DOING_TIMELINE) {
    737                 /* This shouldn't normally happen at all but I'm currently hunting a bug
    738                    where it does. Instead of having users suffer under it, have a work-
    739                    around with a warning. */
    740                 td->flags |= TWITTER_DOING_TIMELINE_SLOW;
    741730                return;
    742731        }
     
    828817        }
    829818
    830         twitter_http(ic, TWITTER_HOME_TIMELINE_URL, twitter_http_get_home_timeline, ic, 0, args,
    831                      td->timeline_id ? 6 : 4);
     819        if (twitter_http(ic, TWITTER_HOME_TIMELINE_URL, twitter_http_get_home_timeline, ic, 0, args,
     820                     td->timeline_id ? 6 : 4) == NULL) {
     821                if (++td->http_fails >= 5)
     822                        imcb_error(ic, "Could not retrieve %s: %s",
     823                                   TWITTER_HOME_TIMELINE_URL, "connection failed");
     824                td->flags |= TWITTER_GOT_TIMELINE;
     825                twitter_flush_timeline(ic);
     826        }
    832827
    833828        g_free(args[1]);
     
    857852        }
    858853
    859         twitter_http(ic, TWITTER_MENTIONS_URL, twitter_http_get_mentions, ic, 0, args,
    860                      td->timeline_id ? 6 : 4);
     854        if (twitter_http(ic, TWITTER_MENTIONS_URL, twitter_http_get_mentions, ic, 0, args,
     855                     td->timeline_id ? 6 : 4) == NULL) {
     856                if (++td->http_fails >= 5)
     857                        imcb_error(ic, "Could not retrieve %s: %s",
     858                                   TWITTER_MENTIONS_URL, "connection failed");
     859                td->flags |= TWITTER_GOT_MENTIONS;
     860                twitter_flush_timeline(ic);
     861        }
    861862
    862863        g_free(args[1]);
     
    946947                // It didn't go well, output the error and return.
    947948                if (++td->http_fails >= 5)
    948                         imcb_error(ic, "Could not retrieve " TWITTER_MENTIONS_URL ": %s",
    949                                    twitter_parse_error(req));
     949                        imcb_error(ic, "Could not retrieve %s: %s",
     950                                   TWITTER_MENTIONS_URL, twitter_parse_error(req));
    950951
    951952                goto end;
Note: See TracChangeset for help on using the changeset viewer.