[fedora-virt] [PATCH] Remove receive callbacks (libguestfs)

Matthew Booth mbooth at redhat.com
Wed Jul 1 17:19:13 UTC 2009


 From commit message:
========
This patch fixes a class of race conditions characterised by the
following sequence of events:

LIBRARY                                 DAEMON
send download request
                                         receive download request
                                         respond with download response
                                         start sending file chunks
set reply callback to 'download'
run main loop

At this stage the download reply callback receives both the download
reply and some file chunks. The current architecture doesn't provide a 
clean way
to prevent this from happening.

This patch fixes the above problem by changing the socket receive
handler to do nothing but buffering, and provides 2 new apis:

guestfs_get_reply
guestfs_free_reply

These will always de-queue exactly 1 message, which is always what is
wanted.
=======

This is a fairly invasive patch. Note that it still uses the main loop 
for reading and writing data to the socket.

The patch also looks a lot bigger than it really is, because it changes 
the auto-generated code. I'm separately planning to remove 
auto-generated code from git.

Matt
-- 
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team

M:       +44 (0)7977 267231
GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-Remove-receive-callbacks.patch
URL: <http://listman.redhat.com/archives/fedora-virt/attachments/20090701/dd4a015b/attachment.ksh>


More information about the Fedora-virt mailing list