Browse Source

[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>
tags/v1.20.1
Michael Brown 5 years ago
parent
commit
f6b2bf9507
1 changed files with 21 additions and 0 deletions
  1. 21
    0
      src/net/tcp.c

+ 21
- 0
src/net/tcp.c View File

17
 #include <ipxe/netdevice.h>
17
 #include <ipxe/netdevice.h>
18
 #include <ipxe/profile.h>
18
 #include <ipxe/profile.h>
19
 #include <ipxe/process.h>
19
 #include <ipxe/process.h>
20
+#include <ipxe/job.h>
20
 #include <ipxe/tcpip.h>
21
 #include <ipxe/tcpip.h>
21
 #include <ipxe/tcp.h>
22
 #include <ipxe/tcp.h>
22
 
23
 
1704
 	return 0;
1705
 	return 0;
1705
 }
1706
 }
1706
 
1707
 
1708
+/**
1709
+ * Report job progress
1710
+ *
1711
+ * @v tcp		TCP connection
1712
+ * @v progress		Progress report to fill in
1713
+ * @ret ongoing_rc	Ongoing job status code (if known)
1714
+ */
1715
+static int tcp_progress ( struct tcp_connection *tcp,
1716
+			  struct job_progress *progress ) {
1717
+
1718
+	/* Report connection in progress if applicable */
1719
+	if ( ! TCP_HAS_BEEN_ESTABLISHED ( tcp->tcp_state ) ) {
1720
+		snprintf ( progress->message, sizeof ( progress->message ),
1721
+			   "connecting" );
1722
+	}
1723
+
1724
+	return 0;
1725
+}
1726
+
1707
 /** TCP data transfer interface operations */
1727
 /** TCP data transfer interface operations */
1708
 static struct interface_operation tcp_xfer_operations[] = {
1728
 static struct interface_operation tcp_xfer_operations[] = {
1709
 	INTF_OP ( xfer_deliver, struct tcp_connection *, tcp_xfer_deliver ),
1729
 	INTF_OP ( xfer_deliver, struct tcp_connection *, tcp_xfer_deliver ),
1710
 	INTF_OP ( xfer_window, struct tcp_connection *, tcp_xfer_window ),
1730
 	INTF_OP ( xfer_window, struct tcp_connection *, tcp_xfer_window ),
1731
+	INTF_OP ( job_progress, struct tcp_connection *, tcp_progress ),
1711
 	INTF_OP ( intf_close, struct tcp_connection *, tcp_xfer_close ),
1732
 	INTF_OP ( intf_close, struct tcp_connection *, tcp_xfer_close ),
1712
 };
1733
 };
1713
 
1734
 

Loading…
Cancel
Save