summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe
diff options
context:
space:
mode:
authorMichael Brown2015-07-04 13:40:04 +0200
committerMichael Brown2015-07-04 13:51:23 +0200
commit38afcc51ea6cccbbcc40cc4a5bae1213431943ec (patch)
tree7e22748ae4a5f35f14bf2618ccda4c7409f4c842 /src/include/ipxe
parent[xen] Wait for and clear XenStore event before receiving data (diff)
downloadipxe-38afcc51ea6cccbbcc40cc4a5bae1213431943ec.tar.gz
ipxe-38afcc51ea6cccbbcc40cc4a5bae1213431943ec.tar.xz
ipxe-38afcc51ea6cccbbcc40cc4a5bae1213431943ec.zip
[tcp] Gracefully close connections during shutdown
We currently do not wait for a received FIN before exiting to boot a loaded OS. In the common case of booting from an HTTP server, this means that the TCP connection is left consuming resources on the server side: the server will retransmit the FIN several times before giving up. Fix by initiating a graceful close of all TCP connections and waiting (for up to one second) for all connections to finish closing gracefully (i.e. for the outgoing FIN to have been sent and ACKed, and for the incoming FIN to have been received and ACKed at least once). Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe')
-rw-r--r--src/include/ipxe/tcp.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/include/ipxe/tcp.h b/src/include/ipxe/tcp.h
index 65fee85e0..063ebaa4b 100644
--- a/src/include/ipxe/tcp.h
+++ b/src/include/ipxe/tcp.h
@@ -420,6 +420,13 @@ static inline int tcp_in_window ( uint32_t seq, uint32_t start,
return ( ( seq - start ) < len );
}
+/** TCP finish wait time
+ *
+ * Currently set to one second, since we should not allow a slowly
+ * responding server to substantially delay a call to shutdown().
+ */
+#define TCP_FINISH_TIMEOUT ( 1 * TICKS_PER_SEC )
+
extern struct tcpip_protocol tcp_protocol __tcpip_protocol;
#endif /* _IPXE_TCP_H */