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

Submitted by Uri Lublin on Dec. 13, 2012, 1:54 p.m.

Details

Message ID c4da12469d57fbc906a644a6e0e0f9d3bb889975.1355406296.git.uril@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Uri Lublin Dec. 13, 2012, 1:54 p.m.
replaced with spice_error where abort is wanted.
---
 server/red_worker.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

Patch hide | download patch | download mbox

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);

Comments

On 12/13/2012 03:54 PM, Uri Lublin wrote:
> replaced with spice_error where abort is wanted.

Note, that I did not change all spice_critical to spice_error.

For example for lz/quic/glz _usr_error functions I kept it as 
spice_critical.
(I'm not sure about that move as there is a comment in
glz_usr_error() that warns about it)

But e.g. in display_channel_client_wait_for_init(), I think that 
disconnecting
the client and continue going should be fine.


If people prefer, I can change all spice_critical to spice_error and 
later we can
undo that one-by-one.

Thanks,
     Uri.