Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Florian Fischer
emper-echo-server
Commits
60749408
Commit
60749408
authored
Oct 17, 2020
by
Florian Fischer
Browse files
use the sync_* functions exportet by emper
parent
235c01b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/emper-echo-server.c
View file @
60749408
...
...
@@ -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
=
a
sync_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
=
a
sync_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
=
a
sync_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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment