X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=bluesky%2Fs3store.c;fp=bluesky%2Fs3store.c;h=2e1eb17c53b42031c12489efdc472bed77689c37;hb=dc5933ed00033bde61c68a88606a54c423257f5a;hp=1a9e6b980de6a625e064e223a0c1f989878074af;hpb=f6cf25a6403fae7297c8d8913815dbd7a87f4f0b;p=bluesky.git diff --git a/bluesky/s3store.c b/bluesky/s3store.c index 1a9e6b9..2e1eb17 100644 --- a/bluesky/s3store.c +++ b/bluesky/s3store.c @@ -61,6 +61,7 @@ static void s3store_destroy(gpointer store) } struct get_info { + int success; GString *buf; }; @@ -98,8 +99,15 @@ static void s3store_response_callback(S3Status status, const S3ErrorDetails *errorDetails, void *callbackData) { + struct get_info *info = (struct get_info *)callbackData; + g_print("S3 operation complete, status=%s, now=%ld\n", S3_get_status_name(status), bluesky_now_hires()); + + if (status == 0) { + info->success = 1; + } + if (errorDetails != NULL) { g_print(" Error message: %s\n", errorDetails->message); } @@ -111,6 +119,7 @@ static BlueSkyRCStr *s3store_get(gpointer s, const gchar *key) struct get_info info; info.buf = g_string_new(""); + info.success = 0; struct S3GetObjectHandler handler; handler.responseHandler.propertiesCallback = s3store_properties_callback; @@ -121,6 +130,11 @@ static BlueSkyRCStr *s3store_get(gpointer s, const gchar *key) S3_get_object(&store->bucket, key, NULL, 0, 0, NULL, &handler, &info); + if (!info.success) { + g_string_free(info.buf, TRUE); + return NULL; + } + BlueSkyRCStr *raw, *decrypted; raw = bluesky_string_new_from_gstring(info.buf); decrypted = bluesky_crypt_decrypt(raw, store->encryption_key);