summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2019-10-17 17:20:20 -0600
committerJens Axboe <axboe@kernel.dk>2019-10-17 17:20:20 -0600
commit7469f9f6d34b12d75e7288fa1201f591142c5a62 (patch)
tree640261d9bb41ea9a93984e20d7832a8d1ab7c5ee
parente8b0100c17eec78766498f9bed273988b76dc215 (diff)
downloadliburing-7469f9f6d34b12d75e7288fa1201f591142c5a62.tar.gz
liburing-7469f9f6d34b12d75e7288fa1201f591142c5a62.tar.bz2
test/socket-rw.c: use TCP, not pipes
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/socket-rw.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/test/socket-rw.c b/test/socket-rw.c
index 0feafd7..454bbc8 100644
--- a/test/socket-rw.c
+++ b/test/socket-rw.c
@@ -19,22 +19,20 @@
#include <liburing.h>
-//#define TCP
-
int main(int argc, char *argv[])
{
int p_fd[2];
-#ifdef TCP
int32_t recv_s0 = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, IPPROTO_TCP);
int32_t val = 1;
assert(setsockopt(recv_s0, SOL_SOCKET, SO_REUSEPORT, &val, sizeof(val)) != -1);
+ assert(setsockopt(recv_s0, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) != -1);
struct sockaddr_in addr;
addr.sin_family = AF_INET;
- addr.sin_port = 0x0001;
+ addr.sin_port = 0x1235;
addr.sin_addr.s_addr = 0x0100007fU;
assert(bind(recv_s0, (struct sockaddr*)&addr, sizeof(addr)) != -1);
@@ -72,9 +70,6 @@ int main(int argc, char *argv[])
if (!code)
break;
}
-#else
- assert(pipe(p_fd) != -1);
-#endif
struct io_uring m_io_uring;
@@ -107,7 +102,7 @@ int main(int argc, char *argv[])
io_uring_prep_writev(sqe, p_fd[1], iov, 1, 0);
}
- assert(io_uring_submit(&m_io_uring) != -1);
+ assert(io_uring_submit_and_wait(&m_io_uring, 2) != -1);
struct io_uring_cqe* cqe;
uint32_t head;