diff --git a/world/net/http/fetch.c b/world/net/http/fetch.c index 47eeade..82c8608 100644 --- a/world/net/http/fetch.c +++ b/world/net/http/fetch.c @@ -226,7 +226,7 @@ varargs string content(closure cb, int force, int willbehave) { if (fetched) { if (force) { funcall(cb, fetched, willbehave ? fheaders : copy(fheaders)); - } + } } else { enqueue(ME, ({ cb, willbehave })); } diff --git a/world/net/http/fetch_stream.c b/world/net/http/stream.c similarity index 98% rename from world/net/http/fetch_stream.c rename to world/net/http/stream.c index e406bf9..a1d991e 100644 --- a/world/net/http/fetch_stream.c +++ b/world/net/http/stream.c @@ -14,6 +14,7 @@ int buffer_content(string data) { return 1; } +#if 0 disconnected(string data) { P2(("%O got disconnected:\n%O\n", ME, data)) headers["_fetchtime"] = isotime(ctime(time()), 1); @@ -42,3 +43,5 @@ disconnected(string data) { fetching = 0; return 1; // presume this disc was expected } +#endif + diff --git a/world/net/twitter/client.c b/world/net/twitter/client.c index fd963a1..da88d34 100644 --- a/world/net/twitter/client.c +++ b/world/net/twitter/client.c @@ -15,7 +15,7 @@ * - add this to local/config.c: # ifdef USE_TWITTER_STREAM D(" " NET_PATH "twitter/client\n"); - load_object(NET_PATH "twitter/client")->home_stream(); + load_object(NET_PATH "twitter/client")->connect(); # endif */ #include @@ -196,7 +196,8 @@ home_timeline(mixed *next) { return ua; } -home_stream() { +connect() { + // we currently use a home_stream here home_timeline(#'user_stream); } @@ -222,7 +223,7 @@ user_stream_data(string data, string headers, int http_status, int fetching) { switch (http_status) { case 401: // unauthorized oauth(); - home_stream(); + connect(); case 403: // forbidden case 404: // unknown case 406: // not acceptable @@ -241,14 +242,14 @@ user_stream_data(string data, string headers, int http_status, int fetching) { if (wait > 240) wait = 240; P1(("%O reconnecting in %d seconds.\n", ME, wait)) - call_out(#'home_stream, wait); //'); + call_out(#'connect, wait); //'); } user_stream() { P3(("twitter/client:user_stream()\n")) if (!authorized) return enqueue(ME, ({ #'user_stream })); //'})); friends = 0; - object user_ua = clone_object(NET_PATH "http/fetch_stream"); + object user_ua = clone_object(NET_PATH "http/stream"); user_ua->content(#'user_stream_data, 1, 1); //'); fetch(user_ua, userstream_url + "/user.json"); }