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

use the sync_* functions exportet by emper

parent 235c01b3
......@@ -27,7 +27,7 @@ ssize_t send_all(int fd, const void* buf, size_t len) {
size_t bytes_written = 0;
while (bytes_written < len) {
#ifdef USE_ASYNC_IO
ssize_t new_bytes_written = async_send(fd, buf, len - bytes_written);
ssize_t new_bytes_written = sync_send(fd, buf, len - bytes_written);
#else
ssize_t new_bytes_written = send(fd, buf, len - bytes_written, 0);
#endif
......@@ -49,7 +49,7 @@ void client_func(void* arg) {
char buf[BUF_MAX];
for (;;) {
#ifdef USE_ASYNC_IO
ssize_t bytes_recv = async_recv(client_fd, (void*)&buf, BUF_MAX);
ssize_t bytes_recv = sync_recv(client_fd, (void*)&buf, BUF_MAX);
#else
ssize_t bytes_recv = recv(client_fd, (void*)&buf, BUF_MAX);
#endif
......@@ -109,7 +109,7 @@ static void welcome_func() {
for (;;) {
#ifdef USE_ASYNC_IO
int client_fd = async_accept(sockfd, (struct sockaddr*)&servaddr, sizeof(servaddr));
int client_fd = sync_accept(sockfd, (struct sockaddr*)&servaddr, sizeof(servaddr));
#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