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
e49c52a0
Commit
e49c52a0
authored
Nov 04, 2020
by
Florian Fischer
Browse files
add flags to recv and send calls
parent
a5096157
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/emper-echo-server.c
View file @
e49c52a0
...
...
@@ -27,9 +27,9 @@ 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
=
sync_send
(
fd
,
buf
,
len
-
bytes_written
);
ssize_t
new_bytes_written
=
sync_send
(
fd
,
buf
,
len
-
bytes_written
,
MSG_NOSIGNAL
);
#else
ssize_t
new_bytes_written
=
send
(
fd
,
buf
,
len
-
bytes_written
,
0
);
ssize_t
new_bytes_written
=
send
(
fd
,
buf
,
len
-
bytes_written
,
MSG_NOSIGNAL
);
#endif
if
(
unlikely
(
new_bytes_written
<
1
))
{
return
new_bytes_written
;
...
...
@@ -49,9 +49,9 @@ 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
);
ssize_t
bytes_recv
=
sync_recv
(
client_fd
,
(
void
*
)
&
buf
,
BUF_MAX
,
MSG_WAITALL
);
#else
ssize_t
bytes_recv
=
recv
(
client_fd
,
(
void
*
)
&
buf
,
BUF_MAX
);
ssize_t
bytes_recv
=
recv
(
client_fd
,
(
void
*
)
&
buf
,
BUF_MAX
,
MSG_WAITALL
);
#endif
// socket was shutdown
if
(
unlikely
(
bytes_recv
==
0
))
{
...
...
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