summaryrefslogtreecommitdiffstats
path: root/src/core/xfer.c
diff options
context:
space:
mode:
authorMichael Brown2009-07-06 17:16:59 +0200
committerMichael Brown2009-07-06 17:16:59 +0200
commitb7e93a6a55cadbf14fc0fc8f797d2f576c0c5dda (patch)
tree710f9f9df383f01722bf854f6ae0003bb4c204cf /src/core/xfer.c
parent[pxe] Add startpxe and stoppxe commands (diff)
downloadipxe-b7e93a6a55cadbf14fc0fc8f797d2f576c0c5dda.tar.gz
ipxe-b7e93a6a55cadbf14fc0fc8f797d2f576c0c5dda.tar.xz
ipxe-b7e93a6a55cadbf14fc0fc8f797d2f576c0c5dda.zip
[xfer] Always nullify interface while sending close() message
Objects typically call xfer_close() as part of their response to a close() message. If the initiating object has already nullified the xfer interface then this isn't a problem, but it can lead to unexpected behaviour when the initiating object is aiming to reuse the connection and so does not nullify the interface. Fix by always temporarily nullifying the interface during xfer_close() (as was already being done by xfer_vreopen() in order to work around this specific problem). Reported-by: infernix <infernix@infernix.net> Tested-by: infernix <infernix@infernix.net>
Diffstat (limited to 'src/core/xfer.c')
-rw-r--r--src/core/xfer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/xfer.c b/src/core/xfer.c
index a9bcb4d7..1ec6f9d3 100644
--- a/src/core/xfer.c
+++ b/src/core/xfer.c
@@ -45,11 +45,14 @@ static struct xfer_metadata dummy_metadata;
*/
void xfer_close ( struct xfer_interface *xfer, int rc ) {
struct xfer_interface *dest = xfer_get_dest ( xfer );
+ struct xfer_interface_operations *op = xfer->op;
DBGC ( xfer, "XFER %p->%p close\n", xfer, dest );
xfer_unplug ( xfer );
+ xfer_nullify ( xfer );
dest->op->close ( dest, rc );
+ xfer->op = op;
xfer_put ( dest );
}