Переглянути джерело

[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>
tags/v1.20.1
Michael Brown 13 роки тому
джерело
коміт
ba3633782b
1 змінених файлів з 16 додано та 1 видалено
  1. 16
    1
      src/core/xfer.c

+ 16
- 1
src/core/xfer.c Переглянути файл

@@ -54,6 +54,7 @@ static struct xfer_metadata dummy_metadata;
54 54
  * @ret rc		Return status code
55 55
  */
56 56
 int xfer_vredirect ( struct interface *intf, int type, va_list args ) {
57
+	struct interface tmp = INTF_INIT ( null_intf_desc );
57 58
 	struct interface *dest;
58 59
 	xfer_vredirect_TYPE ( void * ) *op =
59 60
 		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 ) {
66 67
 	if ( op ) {
67 68
 		rc = op ( object, type, args );
68 69
 	} else {
69
-		/* Default is to reopen the interface as instructed */
70
+		/* Default is to reopen the interface as instructed,
71
+		 * then send xfer_window_changed() messages to both
72
+		 * new child and parent interfaces.  Since our
73
+		 * original child interface is likely to be closed and
74
+		 * unplugged as a result of the call to
75
+		 * xfer_vreopen(), we create a temporary interface in
76
+		 * order to be able to send xfer_window_changed() to
77
+		 * the parent.
78
+		 */
79
+		intf_plug ( &tmp, dest );
70 80
 		rc = xfer_vreopen ( dest, type, args );
81
+		if ( rc == 0 ) {
82
+			xfer_window_changed ( dest );
83
+			xfer_window_changed ( &tmp );
84
+		}
85
+		intf_unplug ( &tmp );
71 86
 	}
72 87
 
73 88
 	if ( rc != 0 ) {

Завантаження…
Відмінити
Зберегти