summaryrefslogtreecommitdiffstats
path: root/src/core/xfer.c
diff options
context:
space:
mode:
authorMichael Brown2011-06-22 17:40:13 +0200
committerMichael Brown2011-06-28 15:45:08 +0200
commitba3633782bd36831ca5471d792e626b7e8344e0c (patch)
treea4646c43d7c717f92c6b78494fd747587098b205 /src/core/xfer.c
parent[tcp] Send xfer_window_changed() when window opens (diff)
downloadipxe-ba3633782bd36831ca5471d792e626b7e8344e0c.tar.gz
ipxe-ba3633782bd36831ca5471d792e626b7e8344e0c.tar.xz
ipxe-ba3633782bd36831ca5471d792e626b7e8344e0c.zip
[xfer] Send xfer_window_changed() after xfer_vredirect()
Modify the default action for xfer_vredirect() to automatically send xfer_window_changed() messages to both the new child and the parent interfaces. This will allow the elimination of processes that simply poll on xfer_window() to determine when a redirection has completed successfully. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/xfer.c')
-rw-r--r--src/core/xfer.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/core/xfer.c b/src/core/xfer.c
index a755d438..4d7d6b43 100644
--- a/src/core/xfer.c
+++ b/src/core/xfer.c
@@ -54,6 +54,7 @@ static struct xfer_metadata dummy_metadata;
* @ret rc Return status code
*/
int xfer_vredirect ( struct interface *intf, int type, va_list args ) {
+ struct interface tmp = INTF_INIT ( null_intf_desc );
struct interface *dest;
xfer_vredirect_TYPE ( void * ) *op =
intf_get_dest_op_no_passthru ( intf, xfer_vredirect, &dest );
@@ -66,8 +67,22 @@ int xfer_vredirect ( struct interface *intf, int type, va_list args ) {
if ( op ) {
rc = op ( object, type, args );
} else {
- /* Default is to reopen the interface as instructed */
+ /* Default is to reopen the interface as instructed,
+ * then send xfer_window_changed() messages to both
+ * new child and parent interfaces. Since our
+ * original child interface is likely to be closed and
+ * unplugged as a result of the call to
+ * xfer_vreopen(), we create a temporary interface in
+ * order to be able to send xfer_window_changed() to
+ * the parent.
+ */
+ intf_plug ( &tmp, dest );
rc = xfer_vreopen ( dest, type, args );
+ if ( rc == 0 ) {
+ xfer_window_changed ( dest );
+ xfer_window_changed ( &tmp );
+ }
+ intf_unplug ( &tmp );
}
if ( rc != 0 ) {