Skip to contentSkip to conversation

examples/zcrx: fix just allocated sock struct checks

PATCH Applied Pavel Begunkov 2 participants 2 messages Apr 12 – Apr 15 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples/zcrx: fix just allocated sock struct checks

The line in process_accept() checking sockfd is a leftover from times there was just one static socket. Now it's allocated, and we shouldn't be checking an uninitialised value, which fails the benchmark from time to time.

---
 examples/zcrx.c | 2 --
 1 file changed, 2 deletions(-)
examples/zcrx.c +0 -2
index 4b9f078e..b55b07ce 100644
@@ -356,8 +356,6 @@ static void process_accept(struct io_uring *ring, struct io_uring_cqe *cqe)
 	conn = aligned_alloc(64, sizeof(*conn));
 	if (!conn)
 		t_error(1, 0, "can't allocate conn structure");
-	if (conn->sockfd)
-		t_error(1, 0, "Unexpected second connection");
 
 	memset(conn, 0, sizeof(*conn));
 	conn->sockfd = cqe->res;
Signature · 1 line
2.53.0
maintainer Applied
#1 lore raw
Quoted 4 lines · Pavel Begunkov

The line in process_accept() checking sockfd is a leftover from times there was just one static socket. Now it's allocated, and we shouldn't be checking an uninitialised value, which fails the benchmark from time to time.

Applied, thanks!

[1/1] examples/zcrx: fix just allocated sock struct checks

      commit: 6dc578df309eb6958e7422ff7395e591c80ea7b9

Best regards,

Signature · 1 line
Jens Axboe