[Spice-devel] [PATCH] server: prepare for spice_critical not aborting

Uri Lublin uril at redhat.com
Thu Dec 13 05:54:53 PST 2012


replaced with spice_error where abort is wanted.
---
 server/red_worker.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index 530562b..1ac439b 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -2520,7 +2520,7 @@ static void push_stream_clip(DisplayChannelClient* dcc, StreamAgent *agent)
     int n_rects;
 
     if (!item) {
-        spice_critical("alloc failed");
+        spice_error("alloc failed");
     }
     item->clip_type = SPICE_CLIP_TYPE_RECTS;
 
@@ -5738,7 +5738,7 @@ static inline void red_init_quic(RedWorker *worker)
     worker->quic = quic_create(&worker->quic_data.usr);
 
     if (!worker->quic) {
-        spice_critical("create quic failed");
+        spice_error("create quic failed");
     }
 }
 
@@ -5755,7 +5755,7 @@ static inline void red_init_lz(RedWorker *worker)
     worker->lz = lz_create(&worker->lz_data.usr);
 
     if (!worker->lz) {
-        spice_critical("create lz failed");
+        spice_error("create lz failed");
     }
 }
 
@@ -5780,7 +5780,7 @@ static inline void red_init_jpeg(RedWorker *worker)
     worker->jpeg = jpeg_encoder_create(&worker->jpeg_data.usr);
 
     if (!worker->jpeg) {
-        spice_critical("create jpeg encoder failed");
+        spice_error("create jpeg encoder failed");
     }
 }
 
@@ -5792,7 +5792,7 @@ static inline void red_init_zlib(RedWorker *worker)
     worker->zlib = zlib_encoder_create(&worker->zlib_data.usr, ZLIB_DEFAULT_COMPRESSION_LEVEL);
 
     if (!worker->zlib) {
-        spice_critical("create zlib encoder failed");
+        spice_error("create zlib encoder failed");
     }
 }
 
@@ -9333,7 +9333,7 @@ static inline void red_create_surface(RedWorker *worker, uint32_t surface_id, ui
                                                             width, height, stride,
                                                             surface->context.format, line_0);
         if (!surface->context.canvas) {
-            spice_critical("drawing canvas creating failed - can`t create same type canvas");
+            spice_error("drawing canvas creating failed - can`t create same type canvas");
         }
 
         if (send_client) {
@@ -9361,7 +9361,7 @@ static inline void red_create_surface(RedWorker *worker, uint32_t surface_id, ui
         }
     }
 
-    spice_critical("unable to create drawing canvas");
+    spice_error("unable to create drawing canvas");
 }
 
 static inline void flush_display_commands(RedWorker *worker)
@@ -9485,6 +9485,8 @@ static int display_channel_client_wait_for_init(DisplayChannelClient *dcc)
             dcc->glz = glz_encoder_create(dcc->common.id, dcc->glz_dict->dict, &dcc->glz_data.usr);
             if (!dcc->glz) {
                 spice_critical("create global lz failed");
+                red_channel_client_disconnect(&dcc->common.base);
+                break;
             }
             return TRUE;
         }
@@ -9565,8 +9567,7 @@ static GlzSharedDictionary *red_create_glz_dictionary(DisplayChannelClient *dcc,
     spice_info("Lz Window %d Size=%d", id, window_size);
 #endif
     if (!glz_dict) {
-        spice_critical("failed creating lz dictionary");
-        return NULL;
+        spice_error("failed creating lz dictionary");
     }
     return _red_create_glz_dictionary(dcc->common.base.client, id, glz_dict);
 }
@@ -9578,8 +9579,7 @@ static GlzSharedDictionary *red_create_restored_glz_dictionary(DisplayChannelCli
     GlzEncDictContext *glz_dict = glz_enc_dictionary_restore(restore_data,
                                                              &dcc->glz_data.usr);
     if (!glz_dict) {
-        spice_critical("failed creating lz dictionary");
-        return NULL;
+        spice_error("failed creating lz dictionary");
     }
     return _red_create_glz_dictionary(dcc->common.base.client, id, glz_dict);
 }
@@ -9865,10 +9865,10 @@ static int display_channel_handle_migrate_data(RedChannelClient *rcc, uint32_t s
         dcc->glz = glz_encoder_create(dcc->common.id,
                                       dcc->glz_dict->dict, &dcc->glz_data.usr);
         if (!dcc->glz) {
-            spice_critical("create global lz failed");
+            spice_error("create global lz failed");
         }
     } else {
-        spice_critical("restoring global lz dictionary failed");
+        spice_error("restoring global lz dictionary failed");
     }
     if (migrate_data->low_bandwidth_setting) {
         red_channel_client_ack_set_client_window(rcc, WIDE_CLIENT_ACK_WINDOW);
-- 
1.7.1



More information about the Spice-devel mailing list