[gvfs/gnome-3-8] GVfsChannels: Verify that replies are for the right serial
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/gnome-3-8] GVfsChannels: Verify that replies are for the right serial
- Date: Thu, 4 Apr 2013 17:29:55 +0000 (UTC)
commit e1be69f4bcec01c007016ae33dbb48514b09ba75
Author: Alexander Larsson <alexl redhat com>
Date: Thu Apr 4 19:13:05 2013 +0200
GVfsChannels: Verify that replies are for the right serial
We might be getting replies for old cancelled operations which
we need to ignore.
https://bugzilla.gnome.org/show_bug.cgi?id=675181
client/gdaemonfileinputstream.c | 9 ++++++---
client/gdaemonfileoutputstream.c | 12 ++++++++----
2 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/client/gdaemonfileinputstream.c b/client/gdaemonfileinputstream.c
index f73c681..9fc8ae5 100644
--- a/client/gdaemonfileinputstream.c
+++ b/client/gdaemonfileinputstream.c
@@ -1035,7 +1035,8 @@ iterate_close_state_machine (GDaemonFileInputStream *file, IOOperationData *io_o
op->state = CLOSE_STATE_HANDLE_INPUT_BLOCK;
break;
}
- else if (reply.type == G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_CLOSED)
+ else if (reply.type == G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_CLOSED &&
+ reply.seq_nr == op->seq_nr)
{
op->ret_val = TRUE;
g_string_truncate (file->input_buffer, 0);
@@ -1301,7 +1302,8 @@ iterate_seek_state_machine (GDaemonFileInputStream *file, IOOperationData *io_op
op->state = SEEK_STATE_HANDLE_INPUT_BLOCK;
break;
}
- else if (reply.type == G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_SEEK_POS)
+ else if (reply.type == G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_SEEK_POS &&
+ reply.seq_nr == op->seq_nr)
{
op->ret_val = TRUE;
op->ret_offset = ((goffset)reply.arg2) << 32 | (goffset)reply.arg1;
@@ -1580,7 +1582,8 @@ iterate_query_state_machine (GDaemonFileInputStream *file,
op->state = QUERY_STATE_HANDLE_INPUT_BLOCK;
break;
}
- else if (reply.type == G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_INFO)
+ else if (reply.type == G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_INFO &&
+ reply.seq_nr == op->seq_nr)
{
op->info = gvfs_file_info_demarshal (data, reply.arg2);
g_string_truncate (file->input_buffer, 0);
diff --git a/client/gdaemonfileoutputstream.c b/client/gdaemonfileoutputstream.c
index 70535b1..ece1d2e 100644
--- a/client/gdaemonfileoutputstream.c
+++ b/client/gdaemonfileoutputstream.c
@@ -599,7 +599,8 @@ iterate_write_state_machine (GDaemonFileOutputStream *file, IOOperationData *io_
g_string_truncate (file->input_buffer, 0);
return STATE_OP_DONE;
}
- else if (reply.type == G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_WRITTEN)
+ else if (reply.type == G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_WRITTEN &&
+ reply.seq_nr == op->seq_nr)
{
op->ret_val = reply.arg1;
g_string_truncate (file->input_buffer, 0);
@@ -757,7 +758,8 @@ iterate_close_state_machine (GDaemonFileOutputStream *file, IOOperationData *io_
g_string_truncate (file->input_buffer, 0);
return STATE_OP_DONE;
}
- else if (reply.type == G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_CLOSED)
+ else if (reply.type == G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_CLOSED &&
+ reply.seq_nr == op->seq_nr)
{
op->ret_val = TRUE;
if (reply.arg2 > 0)
@@ -951,7 +953,8 @@ iterate_seek_state_machine (GDaemonFileOutputStream *file, IOOperationData *io_o
g_string_truncate (file->input_buffer, 0);
return STATE_OP_DONE;
}
- else if (reply.type == G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_SEEK_POS)
+ else if (reply.type == G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_SEEK_POS &&
+ reply.seq_nr == op->seq_nr)
{
op->ret_val = TRUE;
op->ret_offset = ((goffset)reply.arg2) << 32 | (goffset)reply.arg1;
@@ -1133,7 +1136,8 @@ iterate_query_state_machine (GDaemonFileOutputStream *file,
g_string_truncate (file->input_buffer, 0);
return STATE_OP_DONE;
}
- else if (reply.type == G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_INFO)
+ else if (reply.type == G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_INFO &&
+ reply.seq_nr == op->seq_nr)
{
op->info = gvfs_file_info_demarshal (data, reply.arg2);
g_string_truncate (file->input_buffer, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]