server/red_channel: remove red_channel_client_item_being_sent

The above routine was risky, since red_channel_client_init_send_data
can also be called with item==NULL. Thus, not all pipe items can be tracked.
The one call that was made for this routine was not necessary.
This commit is contained in:
Yonit Halperin 2012-05-24 11:00:33 +03:00
parent 038ae54b1c
commit c59b2884a2
3 changed files with 1 additions and 31 deletions

View File

@ -1374,25 +1374,6 @@ int red_channel_get_first_socket(RedChannel *channel)
RedChannelClient, channel_link)->stream->socket;
}
int red_channel_client_item_being_sent(RedChannelClient *rcc, PipeItem *item)
{
return rcc->send_data.item == item;
}
int red_channel_item_being_sent(RedChannel *channel, PipeItem *item)
{
RingItem *link;
RedChannelClient *rcc;
RING_FOREACH(link, &channel->clients) {
rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link);
if (rcc->send_data.item == item) {
return TRUE;
}
}
return FALSE;
}
int red_channel_no_item_being_sent(RedChannel *channel)
{
RingItem *link;

View File

@ -432,15 +432,6 @@ int red_channel_client_blocked(RedChannelClient *rcc);
/* helper for channels that have complex logic that can possibly ready a send */
int red_channel_client_send_message_pending(RedChannelClient *rcc);
/* returns TRUE if item is being sent by one of the channel clients. This will
* be true if someone called init_send_data but send has not completed (or perhaps
* hasn't even begun, i.e. no one called begin_send_).
* However, note that red_channel_client_init_send_data can also be called with
* item==NULL, thus not all pipe items can be tracked.
*/
int red_channel_item_being_sent(RedChannel *channel, PipeItem *item);
int red_channel_client_item_being_sent(RedChannelClient *rcc, PipeItem *item);
int red_channel_no_item_being_sent(RedChannel *channel);
int red_channel_client_no_item_being_sent(RedChannelClient *rcc);

View File

@ -10364,9 +10364,7 @@ static void red_wait_pipe_item_sent(RedChannelClient *rcc, PipeItem *item)
spice_printerr("timeout");
red_channel_client_disconnect(rcc);
} else {
if (red_channel_client_item_being_sent(rcc, item)) {
red_wait_outgoing_item(rcc);
}
red_wait_outgoing_item(rcc);
}
channel->channel_cbs.release_item(rcc, item, FALSE);
}