[Spice-commits] 4 commits - server/agent-msg-filter.c server/char-device.c server/dcc.c server/dispatcher.c server/inputs-channel.c server/inputs-channel-client.c server/main-channel.c server/main-channel-client.c server/net-utils.c server/red-channel-client.c server/red-channel.h server/red-client.c server/red-qxl.c server/red-replay-qxl.c server/red-stream-device.c server/smartcard.c server/smartcard-channel-client.c server/sound.c server/spicevmc.c server/zlib-encoder.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jun 28 12:22:24 UTC 2018
server/agent-msg-filter.c | 8 ++---
server/char-device.c | 9 ++----
server/dcc.c | 6 ++--
server/dispatcher.c | 22 +++++++--------
server/inputs-channel-client.c | 3 +-
server/inputs-channel.c | 8 ++---
server/main-channel-client.c | 55 ++++++++++++++++----------------------
server/main-channel.c | 14 ++++-----
server/net-utils.c | 4 +-
server/red-channel-client.c | 25 +++++++++--------
server/red-channel.h | 3 --
server/red-client.c | 2 -
server/red-qxl.c | 8 -----
server/red-replay-qxl.c | 9 ++----
server/red-stream-device.c | 2 -
server/smartcard-channel-client.c | 5 ++-
server/smartcard.c | 7 ++--
server/sound.c | 21 +++++++++-----
server/spicevmc.c | 16 ++++++-----
server/zlib-encoder.c | 2 -
20 files changed, 111 insertions(+), 118 deletions(-)
New commits:
commit 2a97cec84ce34e9bed68362b1d1ce8eac5f1d924
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Thu Jun 28 13:54:16 2018 +0200
qxl: Remove red_channel_printerr()
It was only used twice, for what looks like adhoc debugging. This commit
removes it, similarly to what was done for some spice_printerr() calls.
Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/red-channel.h b/server/red-channel.h
index 4e7a9066..ad446e60 100644
--- a/server/red-channel.h
+++ b/server/red-channel.h
@@ -232,9 +232,6 @@ void red_channel_disconnect_client(RedChannel *channel, RedChannelClient *rcc);
id_, channel_, ## __VA_ARGS__); \
} while (0)
-#define red_channel_printerr(channel, format, ...) \
- red_channel_log_generic(spice_printerr, channel, format, ## __VA_ARGS__);
-
#define red_channel_warning(channel, format, ...) \
red_channel_log_generic(g_warning, channel, format, ## __VA_ARGS__);
diff --git a/server/red-qxl.c b/server/red-qxl.c
index ac7b10a1..854d019b 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -114,8 +114,6 @@ static void red_qxl_display_migrate(RedChannelClient *rcc)
Dispatcher *dispatcher;
RedChannel *channel = red_channel_client_get_channel(rcc);
- red_channel_printerr(channel, "");
-
dispatcher = (Dispatcher *)g_object_get_data(G_OBJECT(channel), "dispatcher");
payload.rcc = g_object_ref(rcc);
dispatcher_send_message(dispatcher,
@@ -161,8 +159,6 @@ static void red_qxl_cursor_migrate(RedChannelClient *rcc)
Dispatcher *dispatcher;
RedChannel *channel = red_channel_client_get_channel(rcc);
- red_channel_printerr(channel, "");
-
dispatcher = (Dispatcher *)g_object_get_data(G_OBJECT(channel), "dispatcher");
payload.rcc = g_object_ref(rcc);
dispatcher_send_message(dispatcher,
commit ed44faef042b617b16c8325ac307329101ea7df2
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Thu Jun 28 13:54:15 2018 +0200
Replace remaining spice_printerr() with g_warning()
The remaining occurrences of spice_printerr() are warnings when
something unexpected happens, they can be replaced with g_warning() so
that users of spice-server can redirect them with
g_log_set_default_handler().
Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/agent-msg-filter.c b/server/agent-msg-filter.c
index da6640c5..458f563b 100644
--- a/server/agent-msg-filter.c
+++ b/server/agent-msg-filter.c
@@ -52,7 +52,7 @@ AgentMsgFilterResult agent_msg_filter_process_data(AgentMsgFilter *filter,
struct VDAgentMessage msg_header;
if (len > VD_AGENT_MAX_DATA_SIZE) {
- spice_printerr("invalid agent message: too large");
+ g_warning("invalid agent message: too large");
return AGENT_MSG_FILTER_PROTO_ERROR;
}
@@ -60,7 +60,7 @@ AgentMsgFilterResult agent_msg_filter_process_data(AgentMsgFilter *filter,
if (filter->msg_data_to_read) {
data_to_read:
if (len > filter->msg_data_to_read) {
- spice_printerr("invalid agent message: data exceeds size from header");
+ g_warning("invalid agent message: data exceeds size from header");
return AGENT_MSG_FILTER_PROTO_ERROR;
}
filter->msg_data_to_read -= len;
@@ -68,14 +68,14 @@ data_to_read:
}
if (len < sizeof(msg_header)) {
- spice_printerr("invalid agent message: incomplete header");
+ g_warning("invalid agent message: incomplete header");
return AGENT_MSG_FILTER_PROTO_ERROR;
}
memcpy(&msg_header, data, sizeof(msg_header));
len -= sizeof(msg_header);
if (msg_header.protocol != VD_AGENT_PROTOCOL) {
- spice_printerr("invalid agent protocol: %u", msg_header.protocol);
+ g_warning("invalid agent protocol: %u", msg_header.protocol);
return AGENT_MSG_FILTER_PROTO_ERROR;
}
diff --git a/server/char-device.c b/server/char-device.c
index 2b34e402..ae538fab 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -568,7 +568,7 @@ static RedCharDeviceWriteBuffer *__red_char_device_write_buffer_get(
if (dev_client) {
if (!migrated_data_tokens &&
dev_client->do_flow_control && !dev_client->num_client_tokens) {
- spice_printerr("token violation: dev %p client %p", dev, client);
+ g_warning("token violation: dev %p client %p", dev, client);
red_char_device_handle_client_overflow(dev_client);
goto error;
}
@@ -579,7 +579,7 @@ static RedCharDeviceWriteBuffer *__red_char_device_write_buffer_get(
} else {
/* it is possible that the client was removed due to send tokens underflow, but
* the caller still receive messages from the client */
- spice_printerr("client not found: dev %p client %p", dev, client);
+ g_warning("client not found: dev %p client %p", dev, client);
goto error;
}
} else if (origin == WRITE_BUFFER_ORIGIN_SERVER) {
@@ -635,7 +635,7 @@ void red_char_device_write_buffer_add(RedCharDevice *dev,
/* caller shouldn't add buffers for client that was removed */
if (write_buf->priv->origin == WRITE_BUFFER_ORIGIN_CLIENT &&
!red_char_device_client_find(dev, write_buf->priv->client)) {
- spice_printerr("client not found: dev %p client %p", dev, write_buf->priv->client);
+ g_warning("client not found: dev %p client %p", dev, write_buf->priv->client);
red_char_device_write_buffer_pool_add(dev, write_buf);
return;
}
@@ -658,7 +658,7 @@ void red_char_device_write_buffer_release(RedCharDevice *dev,
RedClient *client = write_buf->priv->client;
if (!dev) {
- spice_printerr("no device. write buffer is freed");
+ g_warning("no device. write buffer is freed");
red_char_device_write_buffer_free(write_buf);
return;
}
diff --git a/server/dispatcher.c b/server/dispatcher.c
index 3e0decde..0953db87 100644
--- a/server/dispatcher.c
+++ b/server/dispatcher.c
@@ -259,7 +259,7 @@ static int dispatcher_handle_single_read(Dispatcher *dispatcher)
uint32_t ack = ACK;
if ((ret = read_safe(dispatcher->priv->recv_fd, (uint8_t*)&type, sizeof(type), 0)) == -1) {
- spice_printerr("error reading from dispatcher: %d", errno);
+ g_warning("error reading from dispatcher: %d", errno);
return 0;
}
if (ret == 0) {
@@ -272,7 +272,7 @@ static int dispatcher_handle_single_read(Dispatcher *dispatcher)
}
msg = &dispatcher->priv->messages[type];
if (read_safe(dispatcher->priv->recv_fd, payload, msg->size, 1) == -1) {
- spice_printerr("error reading from dispatcher: %d", errno);
+ g_warning("error reading from dispatcher: %d", errno);
/* TODO: close socketpair? */
return 0;
}
@@ -282,12 +282,12 @@ static int dispatcher_handle_single_read(Dispatcher *dispatcher)
if (msg->handler) {
msg->handler(dispatcher->priv->opaque, payload);
} else {
- spice_printerr("error: no handler for message type %d", type);
+ g_warning("error: no handler for message type %d", type);
}
if (msg->ack) {
if (write_safe(dispatcher->priv->recv_fd,
(uint8_t*)&ack, sizeof(ack)) == -1) {
- spice_printerr("error writing ack for message %d", type);
+ g_warning("error writing ack for message %d", type);
/* TODO: close socketpair? */
}
}
@@ -316,21 +316,21 @@ void dispatcher_send_message(Dispatcher *dispatcher, uint32_t message_type,
msg = &dispatcher->priv->messages[message_type];
pthread_mutex_lock(&dispatcher->priv->lock);
if (write_safe(send_fd, (uint8_t*)&message_type, sizeof(message_type)) == -1) {
- spice_printerr("error: failed to send message type for message %d",
- message_type);
+ g_warning("error: failed to send message type for message %d",
+ message_type);
goto unlock;
}
if (write_safe(send_fd, payload, msg->size) == -1) {
- spice_printerr("error: failed to send message body for message %d",
- message_type);
+ g_warning("error: failed to send message body for message %d",
+ message_type);
goto unlock;
}
if (msg->ack) {
if (read_safe(send_fd, (uint8_t*)&ack, sizeof(ack), 1) == -1) {
- spice_printerr("error: failed to read ack");
+ g_warning("error: failed to read ack");
} else if (ack != ACK) {
- spice_printerr("error: got wrong ack value in dispatcher "
- "for message %d\n", message_type);
+ g_warning("error: got wrong ack value in dispatcher "
+ "for message %d\n", message_type);
/* TODO handling error? */
}
}
diff --git a/server/net-utils.c b/server/net-utils.c
index 90dbbed5..ca8a4e7f 100644
--- a/server/net-utils.c
+++ b/server/net-utils.c
@@ -47,7 +47,7 @@ bool red_socket_set_keepalive(int fd, bool enable, int timeout)
if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &keepalive, sizeof(keepalive)) == -1) {
if (errno != ENOTSUP) {
- spice_printerr("setsockopt for keepalive failed, %s", strerror(errno));
+ g_warning("setsockopt for keepalive failed, %s", strerror(errno));
return false;
}
}
@@ -59,7 +59,7 @@ bool red_socket_set_keepalive(int fd, bool enable, int timeout)
#ifdef HAVE_TCP_KEEPIDLE
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &timeout, sizeof(timeout)) == -1) {
if (errno != ENOTSUP) {
- spice_printerr("setsockopt for keepalive timeout failed, %s", strerror(errno));
+ g_warning("setsockopt for keepalive timeout failed, %s", strerror(errno));
return false;
}
}
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 92880fc5..b3a6ec12 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -1144,7 +1144,7 @@ static int red_peer_receive(RedStream *stream, uint8_t *buf, uint32_t size)
} else if (errno == EPIPE) {
return -1;
} else {
- spice_printerr("%s", strerror(errno));
+ g_warning("%s", strerror(errno));
return -1;
}
} else {
diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
index a23296cf..1fce76cb 100644
--- a/server/red-replay-qxl.c
+++ b/server/red-replay-qxl.c
@@ -475,7 +475,7 @@ static QXLImage *red_replay_image(SpiceReplay *replay, uint32_t flags)
} else {
size = red_replay_data_chunks(replay, "bitmap.data", (uint8_t**)&qxl->bitmap.data, 0);
if (size != bitmap_size) {
- spice_printerr("bad image, %" PRIuPTR " != %" PRIuPTR, size, bitmap_size);
+ g_warning("bad image, %" PRIuPTR " != %" PRIuPTR, size, bitmap_size);
return NULL;
}
}
@@ -1137,7 +1137,7 @@ static QXLSurfaceCmd *red_replay_surface_cmd(SpiceReplay *replay)
if ((qxl->flags & QXL_SURF_FLAG_KEEP_DATA) != 0) {
read_binary(replay, "data", &read_size, (uint8_t**)&qxl->u.surface_create.data, 0);
if (read_size != size) {
- spice_printerr("mismatch %" PRIuPTR " != %" PRIuPTR, size, read_size);
+ g_warning("mismatch %" PRIuPTR " != %" PRIuPTR, size, read_size);
}
} else {
qxl->u.surface_create.data = QXLPHYSICAL_FROM_PTR(replay_malloc(replay, size));
@@ -1240,9 +1240,8 @@ static void replay_handle_create_primary(QXLWorker *worker, SpiceReplay *replay)
uint8_t *mem = NULL;
if (replay->created_primary) {
- spice_printerr(
- "WARNING: %d: original recording event not preceded by a destroy primary",
- replay->counter);
+ g_warning("WARNING: %d: original recording event not preceded by a destroy primary",
+ replay->counter);
worker->destroy_primary_surface(worker, 0);
}
replay->created_primary = TRUE;
diff --git a/server/red-stream-device.c b/server/red-stream-device.c
index 71b1b83b..f280a089 100644
--- a/server/red-stream-device.c
+++ b/server/red-stream-device.c
@@ -469,7 +469,7 @@ stream_device_send_msg_to_client(RedCharDevice *self, RedPipeItem *msg, RedClien
static void
stream_device_send_tokens_to_client(RedCharDevice *self, RedClient *client, uint32_t tokens)
{
- spice_printerr("Not implemented!");
+ g_warning("%s: Not implemented!", G_STRFUNC);
}
static void
diff --git a/server/zlib-encoder.c b/server/zlib-encoder.c
index 7b98abbb..6042cffd 100644
--- a/server/zlib-encoder.c
+++ b/server/zlib-encoder.c
@@ -51,7 +51,7 @@ ZlibEncoder* zlib_encoder_create(ZlibEncoderUsrContext *usr, int level)
z_ret = deflateInit(&enc->strm, level);
enc->last_level = level;
if (z_ret != Z_OK) {
- spice_printerr("zlib error");
+ g_warning("zlib error");
g_free(enc);
return NULL;
}
commit 2367497909ca6b8d961dfab23189e07b7466ac3e
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Thu Jun 28 13:54:14 2018 +0200
Replace spice_printerr() use with red_channel_{debug, warning}
Depending on the context, we want to output a warning or just a debug
log.
Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/dcc.c b/server/dcc.c
index d96f1b2b..a5d2b344 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -693,7 +693,8 @@ RedPipeItem *dcc_gl_scanout_item_new(RedChannelClient *rcc, void *data, int num)
/* FIXME: on !unix peer, start streaming with a video codec */
if (!red_stream_is_plain_unix(red_channel_client_get_stream(rcc)) ||
!red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_GL_SCANOUT)) {
- spice_printerr("FIXME: client does not support GL scanout");
+ red_channel_warning(red_channel_client_get_channel(rcc),
+ "FIXME: client does not support GL scanout");
red_channel_client_disconnect(rcc);
return NULL;
}
@@ -712,7 +713,8 @@ RedPipeItem *dcc_gl_draw_item_new(RedChannelClient *rcc, void *data, int num)
if (!red_stream_is_plain_unix(red_channel_client_get_stream(rcc)) ||
!red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_GL_SCANOUT)) {
- spice_printerr("FIXME: client does not support GL scanout");
+ red_channel_warning(red_channel_client_get_channel(rcc),
+ "FIXME: client does not support GL scanout");
red_channel_client_disconnect(rcc);
return NULL;
}
diff --git a/server/inputs-channel-client.c b/server/inputs-channel-client.c
index 25ad64a6..5fd818a1 100644
--- a/server/inputs-channel-client.c
+++ b/server/inputs-channel-client.c
@@ -49,7 +49,8 @@ inputs_channel_client_alloc_msg_rcv_buf(RedChannelClient *rcc,
uint16_t type, uint32_t size)
{
if (size > RECEIVE_BUF_SIZE) {
- spice_printerr("error: too large incoming message");
+ red_channel_warning(red_channel_client_get_channel(rcc),
+ "error: too large incoming message");
return NULL;
}
diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index 3f6fae81..e01bb7d0 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -606,7 +606,7 @@ static SpiceKbdInstance* inputs_channel_get_keyboard(InputsChannel *inputs)
int inputs_channel_set_keyboard(InputsChannel *inputs, SpiceKbdInstance *keyboard)
{
if (inputs->keyboard) {
- spice_printerr("already have keyboard");
+ red_channel_warning(RED_CHANNEL(inputs), "already have keyboard");
return -1;
}
inputs->keyboard = keyboard;
@@ -622,7 +622,7 @@ static SpiceMouseInstance* inputs_channel_get_mouse(InputsChannel *inputs)
int inputs_channel_set_mouse(InputsChannel *inputs, SpiceMouseInstance *mouse)
{
if (inputs->mouse) {
- spice_printerr("already have mouse");
+ red_channel_warning(RED_CHANNEL(inputs), "already have mouse");
return -1;
}
inputs->mouse = mouse;
@@ -638,7 +638,7 @@ static SpiceTabletInstance* inputs_channel_get_tablet(InputsChannel *inputs)
int inputs_channel_set_tablet(InputsChannel *inputs, SpiceTabletInstance *tablet)
{
if (inputs->tablet) {
- spice_printerr("already have tablet");
+ red_channel_warning(RED_CHANNEL(inputs), "already have tablet");
return -1;
}
inputs->tablet = tablet;
diff --git a/server/main-channel-client.c b/server/main-channel-client.c
index 6617f139..b1e5a3e8 100644
--- a/server/main-channel-client.c
+++ b/server/main-channel-client.c
@@ -528,9 +528,10 @@ void main_channel_client_handle_pong(MainChannelClient *mcc, SpiceMsgPing *ping,
mcc->priv->net_test_id = 0;
if (roundtrip <= mcc->priv->latency) {
// probably high load on client or server result with incorrect values
- spice_printerr("net test: invalid values, latency %" PRIu64
- " roundtrip %" PRIu64 ". assuming high"
- "bandwidth", mcc->priv->latency, roundtrip);
+ red_channel_debug(red_channel_client_get_channel(rcc),
+ "net test: invalid values, latency %" PRIu64
+ " roundtrip %" PRIu64 ". assuming high"
+ "bandwidth", mcc->priv->latency, roundtrip);
mcc->priv->latency = 0;
mcc->priv->net_test_stage = NET_TEST_STAGE_INVALID;
red_channel_client_start_connectivity_monitoring(rcc,
@@ -540,19 +541,21 @@ void main_channel_client_handle_pong(MainChannelClient *mcc, SpiceMsgPing *ping,
mcc->priv->bitrate_per_sec = (uint64_t)(NET_TEST_BYTES * 8) * 1000000
/ (roundtrip - mcc->priv->latency);
mcc->priv->net_test_stage = NET_TEST_STAGE_COMPLETE;
- spice_printerr("net test: latency %f ms, bitrate %"PRIu64" bps (%f Mbps)%s",
- (double)mcc->priv->latency / 1000,
- mcc->priv->bitrate_per_sec,
- (double)mcc->priv->bitrate_per_sec / 1024 / 1024,
- main_channel_client_is_low_bandwidth(mcc) ? " LOW BANDWIDTH" : "");
+ red_channel_debug(red_channel_client_get_channel(rcc),
+ "net test: latency %f ms, bitrate %"PRIu64" bps (%f Mbps)%s",
+ (double)mcc->priv->latency / 1000,
+ mcc->priv->bitrate_per_sec,
+ (double)mcc->priv->bitrate_per_sec / 1024 / 1024,
+ main_channel_client_is_low_bandwidth(mcc) ? " LOW BANDWIDTH" : "");
red_channel_client_start_connectivity_monitoring(rcc,
CLIENT_CONNECTIVITY_TIMEOUT);
break;
default:
- spice_printerr("invalid net test stage, ping id %d test id %d stage %d",
- ping->id,
- mcc->priv->net_test_id,
- mcc->priv->net_test_stage);
+ red_channel_warning(red_channel_client_get_channel(rcc),
+ "invalid net test stage, ping id %d test id %d stage %d",
+ ping->id,
+ mcc->priv->net_test_id,
+ mcc->priv->net_test_stage);
mcc->priv->net_test_stage = NET_TEST_STAGE_INVALID;
}
}
@@ -561,13 +564,15 @@ void main_channel_client_handle_migrate_end(MainChannelClient *mcc)
{
RedClient *client = red_channel_client_get_client(RED_CHANNEL_CLIENT(mcc));
if (!red_client_during_migrate_at_target(client)) {
- spice_printerr("unexpected SPICE_MSGC_MIGRATE_END");
+ red_channel_warning(red_channel_client_get_channel(RED_CHANNEL_CLIENT(mcc)),
+ "unexpected SPICE_MSGC_MIGRATE_END");
return;
}
if (!red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(mcc),
SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE)) {
- spice_printerr("unexpected SPICE_MSGC_MIGRATE_END, "
- "client does not support semi-seamless migration");
+ red_channel_warning(red_channel_client_get_channel(RED_CHANNEL_CLIENT(mcc)),
+ "unexpected SPICE_MSGC_MIGRATE_END, "
+ "client does not support semi-seamless migration");
return;
}
red_client_semi_seamless_migrate_complete(client);
@@ -966,9 +971,10 @@ void main_channel_client_send_item(RedChannelClient *rcc, RedPipeItem *base)
if (!mcc->priv->init_sent &&
!mcc->priv->seamless_mig_dst &&
base->type != RED_PIPE_ITEM_TYPE_MAIN_INIT) {
- spice_printerr("Init msg for client %p was not sent yet "
- "(client is probably during semi-seamless migration). Ignoring msg type %d",
- red_channel_client_get_client(rcc), base->type);
+ red_channel_warning(red_channel_client_get_channel(rcc),
+ "Init msg for client %p was not sent yet "
+ "(client is probably during semi-seamless migration). Ignoring msg type %d",
+ red_channel_client_get_client(rcc), base->type);
return;
}
switch (base->type) {
diff --git a/server/main-channel.c b/server/main-channel.c
index 4afc9b0e..f866fb4a 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -66,8 +66,9 @@ static void main_channel_push_channels(MainChannelClient *mcc)
{
RedChannelClient *rcc = RED_CHANNEL_CLIENT(mcc);
if (red_client_during_migrate_at_target(red_channel_client_get_client(rcc))) {
- spice_printerr("warning: ignoring unexpected SPICE_MSGC_MAIN_ATTACH_CHANNELS"
- "during migration");
+ red_channel_warning(red_channel_client_get_channel(rcc),
+ "warning: ignoring unexpected SPICE_MSGC_MAIN_ATTACH_CHANNELS"
+ "during migration");
return;
}
red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_MAIN_CHANNELS_LIST);
@@ -115,7 +116,8 @@ static bool main_channel_handle_migrate_data(RedChannelClient *rcc,
spice_assert(red_channel_get_n_clients(channel) == 1);
if (size < sizeof(SpiceMigrateDataHeader) + sizeof(SpiceMigrateDataMain)) {
- spice_printerr("bad message size %u", size);
+ red_channel_warning(red_channel_client_get_channel(rcc),
+ "bad message size %u", size);
return FALSE;
}
if (!migration_protocol_validate_header(header,
@@ -367,7 +369,7 @@ int main_channel_migrate_src_complete(MainChannel *main_chan, int success)
RedChannelClient *rcc;
if (!red_channel_get_clients(RED_CHANNEL(main_chan))) {
- spice_printerr("no peer connected");
+ red_channel_warning(RED_CHANNEL(main_chan), "no peer connected");
return 0;
}
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 63b3b5b4..92880fc5 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -696,7 +696,8 @@ static void red_channel_client_ping_timer(void *opaque)
/* retrieving the occupied size of the socket's tcp snd buffer (unacked + unsent) */
if (ioctl(rcc->priv->stream->socket, SIOCOUTQ, &so_unsent_size) == -1) {
- spice_printerr("ioctl(SIOCOUTQ) failed, %s", strerror(errno));
+ red_channel_warning(red_channel_client_get_channel(rcc),
+ "ioctl(SIOCOUTQ) failed, %s", strerror(errno));
}
if (so_unsent_size > 0) {
/* tcp snd buffer is still occupied. rescheduling ping */
@@ -957,7 +958,9 @@ static gboolean red_channel_client_initable_init(GInitable *initable,
cleanup:
if (local_error) {
- g_warning("Failed to create channel client: %s", local_error->message);
+ red_channel_warning(red_channel_client_get_channel(self),
+ "Failed to create channel client: %s",
+ local_error->message);
g_propagate_error(error, local_error);
}
return local_error == NULL;
@@ -1095,7 +1098,7 @@ static void red_channel_client_handle_outgoing(RedChannelClient *rcc)
red_channel_client_disconnect(rcc);
return;
default:
- spice_printerr("%s", strerror(errno));
+ red_channel_warning(red_channel_client_get_channel(rcc), "%s", strerror(errno));
red_channel_client_disconnect(rcc);
return;
}
@@ -1220,7 +1223,7 @@ static void red_channel_client_handle_incoming(RedChannelClient *rcc)
if (!buffer->msg) {
buffer->msg = red_channel_client_alloc_msg_buf(rcc, msg_type, msg_size);
if (buffer->msg == NULL) {
- spice_printerr("ERROR: channel refused to allocate buffer.");
+ red_channel_warning(channel, "ERROR: channel refused to allocate buffer.");
red_channel_client_disconnect(rcc);
return;
}
@@ -1248,7 +1251,7 @@ static void red_channel_client_handle_incoming(RedChannelClient *rcc)
msg_type,
&parsed_size, &parsed_free);
if (parsed == NULL) {
- spice_printerr("failed to parse message type %d", msg_type);
+ red_channel_warning(channel, "failed to parse message type %d", msg_type);
red_channel_client_release_msg_buf(rcc,
msg_type, msg_size,
buffer->msg);
@@ -1314,7 +1317,8 @@ void red_channel_client_push(RedChannelClient *rcc)
if (!red_channel_client_no_item_being_sent(rcc) && !red_channel_client_is_blocked(rcc)) {
red_channel_client_set_blocked(rcc);
- spice_printerr("ERROR: an item waiting to be sent and not blocked");
+ red_channel_warning(red_channel_client_get_channel(rcc),
+ "ERROR: an item waiting to be sent and not blocked");
}
while ((pipe_item = red_channel_client_pipe_item_get(rcc))) {
@@ -1445,7 +1449,7 @@ bool red_channel_client_handle_message(RedChannelClient *rcc, uint16_t type,
switch (type) {
case SPICE_MSGC_ACK_SYNC:
if (size != sizeof(uint32_t)) {
- spice_printerr("bad message size");
+ red_channel_warning(red_channel_client_get_channel(rcc), "bad message size");
return FALSE;
}
rcc->priv->ack_data.client_generation = *(uint32_t *)(message);
@@ -1475,7 +1479,7 @@ bool red_channel_client_handle_message(RedChannelClient *rcc, uint16_t type,
red_channel_client_handle_pong(rcc, message);
break;
default:
- spice_printerr("invalid message type %u", type);
+ red_channel_warning(red_channel_client_get_channel(rcc), "invalid message type %u", type);
return FALSE;
}
return TRUE;
@@ -1494,7 +1498,7 @@ void red_channel_client_begin_send_message(RedChannelClient *rcc)
// TODO - better check: type in channel_allowed_types. Better: type in channel_allowed_types(channel_state)
if (rcc->priv->send_data.header.get_msg_type(&rcc->priv->send_data.header) == 0) {
- spice_printerr("BUG: header->type == 0");
+ red_channel_warning(red_channel_client_get_channel(rcc), "BUG: header->type == 0");
return;
}
diff --git a/server/smartcard-channel-client.c b/server/smartcard-channel-client.c
index a0c1d8aa..1ae3ae3e 100644
--- a/server/smartcard-channel-client.c
+++ b/server/smartcard-channel-client.c
@@ -318,8 +318,9 @@ bool smartcard_channel_client_handle_message(RedChannelClient *rcc,
/* todo: fix */
if (vheader->reader_id >= smartcard_get_n_readers()) {
- spice_printerr("ERROR: received message for non existing reader: %d, %d, %d", vheader->reader_id,
- vheader->type, vheader->length);
+ red_channel_warning(red_channel_client_get_channel(rcc),
+ "ERROR: received message for non existing reader: %d, %d, %d",
+ vheader->reader_id, vheader->type, vheader->length);
return FALSE;
}
spice_assert(scc->priv->write_buf->buf == msg);
diff --git a/server/smartcard.c b/server/smartcard.c
index e9cb32e0..2cb68e06 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -220,7 +220,9 @@ RedMsgItem *smartcard_char_device_on_message_from_device(RedCharDeviceSmartcard
}
/* We pass any VSC_Error right now - might need to ignore some? */
if (dev->priv->reader_id == VSCARD_UNDEFINED_READER_ID && vheader->type != VSC_Init) {
- spice_printerr("error: reader_id not assigned for message of type %d", vheader->type);
+ red_channel_warning(red_channel_client_get_channel(RED_CHANNEL_CLIENT(dev->priv->scc)),
+ "error: reader_id not assigned for message of type %d",
+ vheader->type);
}
if (dev->priv->scc) {
sent_header = g_memdup(vheader, sizeof(*vheader) + vheader->length);
@@ -529,7 +531,7 @@ static void smartcard_connect_client(RedChannel *channel, RedClient *client,
if (char_device) {
smartcard_char_device_attach_client(char_device, scc);
} else {
- spice_printerr("char dev unavailable");
+ red_channel_warning(channel, "char dev unavailable");
}
}
diff --git a/server/sound.c b/server/sound.c
index ba7b4d4b..8cdb7d71 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -364,12 +364,15 @@ record_channel_handle_message(RedChannelClient *rcc, uint16_t type, uint32_t siz
SND_CODEC_DECODE) == SND_CODEC_OK) {
record_client->mode = mode->mode;
} else {
- spice_printerr("create decoder failed");
+ red_channel_warning(red_channel_client_get_channel(rcc),
+ "create decoder failed");
return false;
}
}
else {
- spice_printerr("unsupported mode %d", record_client->mode);
+ red_channel_warning(red_channel_client_get_channel(rcc),
+ "unsupported mode %d",
+ record_client->mode);
return false;
}
}
@@ -609,7 +612,7 @@ static bool snd_playback_send_write(PlaybackChannelClient *playback_client)
if (snd_codec_encode(playback_client->codec, (uint8_t *) frame->samples,
snd_codec_frame_size(playback_client->codec) * sizeof(frame->samples[0]),
playback_client->encode_buf, &n) != SND_CODEC_OK) {
- spice_printerr("encode failed");
+ red_channel_warning(red_channel_client_get_channel(rcc), "encode failed");
red_channel_client_disconnect(rcc);
return false;
}
@@ -696,7 +699,8 @@ static void playback_channel_send_item(RedChannelClient *rcc, G_GNUC_UNUSED RedP
if (snd_playback_send_write(playback_client)) {
break;
}
- spice_printerr("snd_send_playback_write failed");
+ red_channel_warning(red_channel_client_get_channel(rcc),
+ "snd_send_playback_write failed");
}
if (client->command & SND_CTRL_MASK) {
client->command &= ~SND_CTRL_MASK;
@@ -779,7 +783,8 @@ static bool snd_channel_client_config_socket(RedChannelClient *rcc)
if (setsockopt(stream->socket, SOL_SOCKET, SO_PRIORITY, (void*)&priority,
sizeof(priority)) == -1) {
if (errno != ENOTSUP) {
- spice_printerr("setsockopt failed, %s", strerror(errno));
+ red_channel_warning(red_channel_client_get_channel(rcc),
+ "setsockopt failed, %s", strerror(errno));
}
}
#endif
@@ -787,7 +792,9 @@ static bool snd_channel_client_config_socket(RedChannelClient *rcc)
tos = IPTOS_LOWDELAY;
if (setsockopt(stream->socket, IPPROTO_IP, IP_TOS, (void*)&tos, sizeof(tos)) == -1) {
if (errno != ENOTSUP) {
- spice_printerr("setsockopt failed, %s", strerror(errno));
+ red_channel_warning(red_channel_client_get_channel(rcc),
+ "setsockopt failed, %s",
+ strerror(errno));
}
}
@@ -1070,7 +1077,7 @@ playback_channel_client_constructed(GObject *object)
SND_CODEC_ENCODE) == SND_CODEC_OK) {
playback_client->mode = desired_mode;
} else {
- spice_printerr("create encoder failed");
+ red_channel_warning(red_channel, "create encoder failed");
}
}
diff --git a/server/spicevmc.c b/server/spicevmc.c
index 5ff564a3..c2de5037 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -424,7 +424,10 @@ static void spicevmc_char_dev_send_tokens_to_client(RedCharDevice *self,
RedClient *client,
uint32_t tokens)
{
- spice_printerr("Not implemented!");
+ RedCharDeviceSpiceVmc *vmc = RED_CHAR_DEVICE_SPICEVMC(self);
+ RedVmcChannel *channel = RED_VMC_CHANNEL(vmc->channel);
+
+ red_channel_warning(RED_CHANNEL(channel), "%s: Not implemented!", G_STRFUNC);
}
static void spicevmc_char_dev_remove_client(RedCharDevice *self,
@@ -454,8 +457,9 @@ static void spicevmc_red_channel_client_on_disconnect(RedChannelClient *rcc)
if (red_char_device_client_exists(channel->chardev, client)) {
red_char_device_client_remove(channel->chardev, client);
} else {
- spice_printerr("client %p have already been removed from char dev %p",
- client, channel->chardev);
+ red_channel_warning(RED_CHANNEL(channel),
+ "client %p have already been removed from char dev %p",
+ client, channel->chardev);
}
}
@@ -768,8 +772,9 @@ static void spicevmc_connect(RedChannel *channel, RedClient *client,
sin = vmc_channel->chardev_sin;
if (vmc_channel->rcc) {
- red_channel_printerr(channel, "channel client (%p) already connected, refusing second connection",
- vmc_channel->rcc);
+ red_channel_warning(RED_CHANNEL(channel),
+ "channel client (%p) already connected, refusing second connection",
+ vmc_channel->rcc);
// TODO: notify client in advance about the in use channel using
// SPICE_MSG_MAIN_CHANNEL_IN_USE (for example)
red_stream_free(stream);
commit 5dbd40129af9670830f02fe93a053dd41dad4a3a
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Thu Jun 28 13:54:13 2018 +0200
Remove unneeded spice_printerr() calls
These calls seem to have been added for debugging for a very specific
purpose. At the very least, they should have been using g_debug() rather
than spice_printerr(). This commit removes these.
Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/char-device.c b/server/char-device.c
index aef6e887..2b34e402 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -216,7 +216,6 @@ static void red_char_device_client_free(RedCharDevice *dev,
static void red_char_device_handle_client_overflow(RedCharDeviceClient *dev_client)
{
RedCharDevice *dev = dev_client->dev;
- spice_printerr("dev %p client %p ", dev, dev_client);
red_char_device_remove_client(dev, dev_client->client);
}
diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index d465f7d3..3f6fae81 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -455,7 +455,6 @@ static void inputs_connect(RedChannel *channel, RedClient *client,
"keyboard channel is insecure");
}
- spice_printerr("inputs channel client create");
rcc = inputs_channel_client_create(channel, client, stream, caps);
if (!rcc) {
return;
@@ -654,7 +653,6 @@ int inputs_channel_has_tablet(InputsChannel *inputs)
void inputs_channel_detach_tablet(InputsChannel *inputs, SpiceTabletInstance *tablet)
{
- spice_printerr("");
if (tablet != NULL && tablet == inputs->tablet) {
spice_tablet_state_free(tablet->st);
tablet->st = NULL;
diff --git a/server/main-channel-client.c b/server/main-channel-client.c
index 7c0977cc..6617f139 100644
--- a/server/main-channel-client.c
+++ b/server/main-channel-client.c
@@ -202,7 +202,6 @@ main_channel_client_release_msg_rcv_buf(RedChannelClient *rcc,
static void main_channel_client_on_disconnect(RedChannelClient *rcc)
{
RedsState *reds = red_channel_get_server(red_channel_client_get_channel(rcc));
- spice_printerr("rcc=%p", rcc);
main_dispatcher_client_disconnect(reds_get_main_dispatcher(reds),
red_channel_client_get_client(rcc));
}
@@ -471,8 +470,6 @@ void main_channel_client_handle_migrate_connected(MainChannelClient *mcc,
int success,
int seamless)
{
- RedClient *client = red_channel_client_get_client(RED_CHANNEL_CLIENT(mcc));
- spice_printerr("client %p connected: %d seamless %d", client, success, seamless);
if (mcc->priv->mig_wait_connect) {
RedChannel *channel = red_channel_client_get_channel(RED_CHANNEL_CLIENT(mcc));
MainChannel *main_channel = MAIN_CHANNEL(channel);
@@ -482,7 +479,6 @@ void main_channel_client_handle_migrate_connected(MainChannelClient *mcc,
main_channel_on_migrate_connected(main_channel, success, seamless);
} else {
if (success) {
- spice_printerr("client %p MIGRATE_CANCEL", client);
red_channel_client_pipe_add_empty_msg(RED_CHANNEL_CLIENT(mcc),
SPICE_MSG_MAIN_MIGRATE_CANCEL);
}
@@ -580,8 +576,6 @@ void main_channel_client_handle_migrate_end(MainChannelClient *mcc)
void main_channel_client_migrate_cancel_wait(MainChannelClient *mcc)
{
if (mcc->priv->mig_wait_connect) {
- spice_printerr("client %p cancel wait connect",
- red_channel_client_get_client(RED_CHANNEL_CLIENT(mcc)));
mcc->priv->mig_wait_connect = FALSE;
mcc->priv->mig_connect_ok = FALSE;
}
@@ -610,23 +604,19 @@ gboolean main_channel_client_migrate_src_complete(MainChannelClient *mcc,
{
gboolean ret = FALSE;
RedChannelClient *rcc = RED_CHANNEL_CLIENT(mcc);
- RedClient *client = red_channel_client_get_client(rcc);
bool semi_seamless_support = red_channel_client_test_remote_cap(rcc,
SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE);
if (semi_seamless_support && mcc->priv->mig_connect_ok) {
if (success) {
- spice_printerr("client %p MIGRATE_END", client);
red_channel_client_pipe_add_empty_msg(rcc,
SPICE_MSG_MAIN_MIGRATE_END);
ret = TRUE;
} else {
- spice_printerr("client %p MIGRATE_CANCEL", client);
red_channel_client_pipe_add_empty_msg(rcc,
SPICE_MSG_MAIN_MIGRATE_CANCEL);
}
} else {
if (success) {
- spice_printerr("client %p SWITCH_HOST", client);
red_channel_client_pipe_add_type(rcc,
RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_SWITCH_HOST);
}
@@ -691,7 +681,6 @@ gboolean main_channel_client_connect_semi_seamless(MainChannelClient *mcc)
SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE)) {
RedClient *client = red_channel_client_get_client(rcc);
if (red_client_during_migrate_at_target(client)) {
- spice_printerr("client %p: wait till previous migration completes", client);
mcc->priv->mig_wait_prev_complete = TRUE;
mcc->priv->mig_wait_prev_try_seamless = FALSE;
} else {
@@ -712,7 +701,6 @@ void main_channel_client_connect_seamless(MainChannelClient *mcc)
spice_assert(red_channel_client_test_remote_cap(rcc,
SPICE_MAIN_CAP_SEAMLESS_MIGRATE));
if (red_client_during_migrate_at_target(client)) {
- spice_printerr("client %p: wait till previous migration completes", client);
mcc->priv->mig_wait_prev_complete = TRUE;
mcc->priv->mig_wait_prev_try_seamless = TRUE;
} else {
@@ -919,7 +907,6 @@ static void main_channel_marshall_migrate_switch(SpiceMarshaller *m, RedChannelC
MainChannel *main_ch;
const RedsMigSpice *mig_target;
- spice_printerr("");
red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST);
main_ch = MAIN_CHANNEL(channel);
mig_target = main_channel_get_migration_target(main_ch);
diff --git a/server/main-channel.c b/server/main-channel.c
index 28395835..4afc9b0e 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -172,7 +172,6 @@ static bool main_channel_handle_message(RedChannelClient *rcc, uint16_t type,
case SPICE_MSGC_MAIN_AGENT_START: {
SpiceMsgcMainAgentStart *tokens;
- spice_printerr("agent start");
tokens = (SpiceMsgcMainAgentStart *)message;
reds_on_main_agent_start(reds, mcc, tokens->num_tokens);
break;
@@ -241,7 +240,6 @@ MainChannelClient *main_channel_link(MainChannel *channel, RedClient *client,
// TODO - migration - I removed it from channel creation, now put it
// into usage somewhere (not an issue until we return migration to it's
// former glory)
- spice_printerr("add main channel client");
mcc = main_channel_client_create(channel, client, stream, connection_id, caps);
return mcc;
}
@@ -368,8 +366,6 @@ int main_channel_migrate_src_complete(MainChannel *main_chan, int success)
int semi_seamless_count = 0;
RedChannelClient *rcc;
- spice_printerr("");
-
if (!red_channel_get_clients(RED_CHANNEL(main_chan))) {
spice_printerr("no peer connected");
return 0;
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 5d256eca..63b3b5b4 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -1722,7 +1722,6 @@ void red_channel_client_disconnect(RedChannelClient *rcc)
if (!red_channel_client_is_connected(rcc)) {
return;
}
- red_channel_printerr(channel, "rcc=%p", rcc);
red_channel_client_pipe_clear(rcc);
if (rcc->priv->stream->watch) {
core->watch_remove(core, rcc->priv->stream->watch);
diff --git a/server/red-client.c b/server/red-client.c
index ddfc5400..7d14bd19 100644
--- a/server/red-client.c
+++ b/server/red-client.c
@@ -175,7 +175,6 @@ void red_client_migrate(RedClient *client)
RedChannelClient *rcc;
RedChannel *channel;
- spice_printerr("migrate client with #channels %d", g_list_length(client->channels));
if (!pthread_equal(pthread_self(), client->thread_id)) {
spice_warning("client->thread_id (0x%lx) != pthread_self (0x%lx)."
"If one of the threads is != io-thread && != vcpu-thread,"
@@ -194,7 +193,6 @@ void red_client_destroy(RedClient *client)
{
RedChannelClient *rcc;
- spice_printerr("destroy client %p with #channels=%d", client, g_list_length(client->channels));
if (!pthread_equal(pthread_self(), client->thread_id)) {
spice_warning("client->thread_id (0x%lx) != pthread_self (0x%lx)."
"If one of the threads is != io-thread && != vcpu-thread,"
diff --git a/server/red-qxl.c b/server/red-qxl.c
index 730b9f3d..ac7b10a1 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -99,7 +99,6 @@ static void red_qxl_disconnect_display_peer(RedChannelClient *rcc)
dispatcher = (Dispatcher *)g_object_get_data(G_OBJECT(channel), "dispatcher");
- spice_printerr("");
payload.rcc = rcc;
// TODO: we turned it to be sync, due to client_destroy . Should we support async? - for this we will need ref count
@@ -130,7 +129,6 @@ static void red_qxl_set_cursor_peer(RedChannel *channel, RedClient *client, RedS
{
RedWorkerMessageCursorConnect payload = {0,};
Dispatcher *dispatcher = (Dispatcher *)g_object_get_data(G_OBJECT(channel), "dispatcher");
- spice_printerr("");
// get a reference potentially the main channel can be destroyed in
// the main thread causing RedClient to be destroyed before using it
payload.client = g_object_ref(client);
@@ -150,7 +148,6 @@ static void red_qxl_disconnect_cursor_peer(RedChannelClient *rcc)
RedChannel *channel = red_channel_client_get_channel(rcc);
dispatcher = (Dispatcher *)g_object_get_data(G_OBJECT(channel), "dispatcher");
- spice_printerr("");
payload.rcc = rcc;
dispatcher_send_message(dispatcher,
@@ -601,7 +598,6 @@ static void red_qxl_loadvm_commands(QXLState *qxl_state,
{
RedWorkerMessageLoadvmCommands payload;
- spice_printerr("");
payload.count = count;
payload.ext = ext;
dispatcher_send_message(qxl_state->dispatcher,
diff --git a/server/smartcard.c b/server/smartcard.c
index effa3de1..e9cb32e0 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -198,7 +198,6 @@ static void smartcard_remove_client(RedCharDevice *self, RedClient *client)
RedCharDeviceSmartcard *dev = RED_CHAR_DEVICE_SMARTCARD(self);
RedChannelClient *rcc = RED_CHANNEL_CLIENT(dev->priv->scc);
- spice_printerr("smartcard dev %p, client %p", dev, client);
spice_assert(dev->priv->scc &&
red_channel_client_get_client(rcc) == client);
red_channel_client_shutdown(rcc);
diff --git a/server/spicevmc.c b/server/spicevmc.c
index 379aa51a..5ff564a3 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -433,7 +433,6 @@ static void spicevmc_char_dev_remove_client(RedCharDevice *self,
RedCharDeviceSpiceVmc *vmc = RED_CHAR_DEVICE_SPICEVMC(self);
RedVmcChannel *channel = RED_VMC_CHANNEL(vmc->channel);
- spice_printerr("vmc channel %p, client %p", channel, client);
spice_assert(channel->rcc &&
red_channel_client_get_client(channel->rcc) == client);
More information about the Spice-commits
mailing list