Thread (13 messages) flat view 13 messages, 2 authors, 2025-01-21

Re: [PATCH net 5/5] vsock/test: Add test for connect() retries

From: Michal Luczaj <hidden>
Date: 2025-01-21 13:20:35

On 1/20/25 11:24, Stefano Garzarella wrote:
On Fri, Jan 17, 2025 at 10:59:45PM +0100, Michal Luczaj wrote:
quoted
+static void test_stream_connect_retry_client(const struct test_opts *opts)
+{
+	struct sockaddr_vm addr = {
+		.svm_family = AF_VSOCK,
+		.svm_cid = opts->peer_cid,
+		.svm_port = opts->peer_port
+	};
+	int s, alen = sizeof(addr);
+
+	s = socket(AF_VSOCK, SOCK_STREAM, 0);
+	if (s < 0) {
+		perror("socket");
+		exit(EXIT_FAILURE);
+	}
+
+	if (!connect(s, (struct sockaddr *)&addr, alen)) {
+		fprintf(stderr, "Unexpected connect() #1 success\n");
+		exit(EXIT_FAILURE);
+	}
+
+	control_writeln("LISTEN");
+	control_expectln("LISTENING");
+
+	if (connect(s, (struct sockaddr *)&addr, alen)) {
+		perror("connect() #2");
+		exit(EXIT_FAILURE);
+	}
What about using the timeout_begin()/timeout_end() we used in all other
places?
Oh, right!

Thanks for the review, all remaining comments addressed.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help