Commit c95cce55 authored by Florian Fischer's avatar Florian Fischer
Browse files

use new emper IO interface

parent 0d20ba85
......@@ -31,7 +31,7 @@ void client_func(void* arg) {
char buf[BUF_MAX];
for (;;) {
#ifdef USE_ASYNC_IO
ssize_t bytes_recv = sync_recv(client_fd, (void*)&buf, BUF_MAX, MSG_WAITALL);
ssize_t bytes_recv = emper_recv(client_fd, (void*)&buf, BUF_MAX, MSG_WAITALL);
#else
ssize_t bytes_recv = recv(client_fd, (void*)&buf, BUF_MAX, MSG_WAITALL);
#endif
......@@ -50,7 +50,7 @@ void client_func(void* arg) {
ssize_t bytes_send = 0;
while (bytes_send < bytes_recv) {
#ifdef USE_ASYNC_IO
ssize_t new_bytes_send = sync_send(client_fd, buf, bytes_recv - bytes_send, MSG_NOSIGNAL);
ssize_t new_bytes_send = emper_send(client_fd, buf, bytes_recv - bytes_send, MSG_NOSIGNAL);
#else
ssize_t new_bytes_send = send(client_fd, buf, bytes_recv - bytes_send, MSG_NOSIGNAL);
#endif
......@@ -101,7 +101,7 @@ static void welcome_func() {
for (;;) {
#ifdef USE_ASYNC_IO
int client_fd = sync_accept(sockfd, (struct sockaddr*)&servaddr, sizeof(servaddr));
int client_fd = emper_accept(sockfd, NULL, NULL);
#else
socklen_t address_len = sizeof(servaddr);
int client_fd = accept(sockfd, (struct sockaddr*)&servaddr, &address_len);
......
......@@ -29,7 +29,7 @@ void client_func(void* arg) {
char buf[BUF_MAX];
for (;;) {
#ifdef USE_ASYNC_IO
ssize_t bytes_recv = io::sync_recv(client_fd, (void*)&buf, BUF_MAX, MSG_WAITALL);
ssize_t bytes_recv = emper::io::recv_and_wait(client_fd, (void*)&buf, BUF_MAX, MSG_WAITALL);
#else
ssize_t bytes_recv = recv(client_fd, (void*)&buf, BUF_MAX, MSG_WAITALL);
#endif
......@@ -49,12 +49,12 @@ void client_func(void* arg) {
ssize_t bytes_send = 0;
while (bytes_send < bytes_recv) {
#ifdef USE_ASYNC_IO
ssize_t new_bytes_send = io::sync_send(client_fd, buf, bytes_recv - bytes_send, MSG_NOSIGNAL);
ssize_t new_bytes_send = emper::io::send_and_wait(client_fd, buf, bytes_recv - bytes_send, MSG_NOSIGNAL);
#else
ssize_t new_bytes_send = send(client_fd, buf, bytes_recv - bytes_send, MSG_NOSIGNAL);
#endif
// socket was shutdown
if (unlikely(bytes_send == 0)) {
if (unlikely(new_bytes_send == 0)) {
return;
}
......@@ -102,7 +102,7 @@ static void welcome_func() {
for (;;) {
#ifdef USE_ASYNC_IO
int client_fd = io::sync_accept(sockfd, (struct sockaddr*)&servaddr, sizeof(servaddr));
int client_fd = emper::io::accept_and_wait(sockfd, nullptr, nullptr);
#else
socklen_t address_len = sizeof(servaddr);
int client_fd = accept(sockfd, (struct sockaddr*)&servaddr, &address_len);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment