aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2019-03-10 17:29:06 +0000
committerMichael Brown <mcb30@ipxe.org>2019-03-10 17:29:06 +0000
commitf6b2bf9507599709d30bcb74af9bffdb179e5338 (patch)
treed90b907d8f2c66877bb51d8874028e10fdd1a066
parent7b63c1275f33e0fa20c0e59dcc1756899533823c (diff)
downloadipxe-f6b2bf9507599709d30bcb74af9bffdb179e5338.zip
ipxe-f6b2bf9507599709d30bcb74af9bffdb179e5338.tar.gz
ipxe-f6b2bf9507599709d30bcb74af9bffdb179e5338.tar.bz2
[tcp] Display "connecting" status until connection is established
Provide increased visibility into the progress of TCP connections by displaying an explicit "connecting" status message while waiting for the TCP handshake to complete. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/net/tcp.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/net/tcp.c b/src/net/tcp.c
index c445100..6bba442 100644
--- a/src/net/tcp.c
+++ b/src/net/tcp.c
@@ -17,6 +17,7 @@
#include <ipxe/netdevice.h>
#include <ipxe/profile.h>
#include <ipxe/process.h>
+#include <ipxe/job.h>
#include <ipxe/tcpip.h>
#include <ipxe/tcp.h>
@@ -1704,10 +1705,30 @@ static int tcp_xfer_deliver ( struct tcp_connection *tcp,
return 0;
}
+/**
+ * Report job progress
+ *
+ * @v tcp TCP connection
+ * @v progress Progress report to fill in
+ * @ret ongoing_rc Ongoing job status code (if known)
+ */
+static int tcp_progress ( struct tcp_connection *tcp,
+ struct job_progress *progress ) {
+
+ /* Report connection in progress if applicable */
+ if ( ! TCP_HAS_BEEN_ESTABLISHED ( tcp->tcp_state ) ) {
+ snprintf ( progress->message, sizeof ( progress->message ),
+ "connecting" );
+ }
+
+ return 0;
+}
+
/** TCP data transfer interface operations */
static struct interface_operation tcp_xfer_operations[] = {
INTF_OP ( xfer_deliver, struct tcp_connection *, tcp_xfer_deliver ),
INTF_OP ( xfer_window, struct tcp_connection *, tcp_xfer_window ),
+ INTF_OP ( job_progress, struct tcp_connection *, tcp_progress ),
INTF_OP ( intf_close, struct tcp_connection *, tcp_xfer_close ),
};