Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
622b22b9
Commit
622b22b9
authored
Jun 14, 2013
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved error messages in fd_util
parent
542ef61a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
16 deletions
+13
-16
src/fd_util.cpp
src/fd_util.cpp
+13
-16
No files found.
src/fd_util.cpp
View file @
622b22b9
...
@@ -60,9 +60,7 @@ void throw_io_failure(const char* what, bool add_errno_failure) {
...
@@ -60,9 +60,7 @@ void throw_io_failure(const char* what, bool add_errno_failure) {
int
rd_flags
(
native_socket_type
fd
)
{
int
rd_flags
(
native_socket_type
fd
)
{
auto
flags
=
fcntl
(
fd
,
F_GETFL
,
0
);
auto
flags
=
fcntl
(
fd
,
F_GETFL
,
0
);
if
(
flags
==
-
1
)
{
if
(
flags
==
-
1
)
throw_io_failure
(
"unable to read socket flags"
);
throw_io_failure
(
"unable to read socket flags"
);
}
return
flags
;
return
flags
;
}
}
...
@@ -94,22 +92,21 @@ void tcp_nodelay(native_socket_type fd, bool new_value) {
...
@@ -94,22 +92,21 @@ void tcp_nodelay(native_socket_type fd, bool new_value) {
}
}
}
}
void
handle_write_result
(
ssize_t
result
,
bool
is_nonblocking_io
)
{
void
handle_io_result
(
ssize_t
res
,
bool
is_nonblock
,
const
char
*
msg
)
{
if
(
result
<
0
)
{
if
(
res
<
0
)
{
if
(
is_nonblocking_io
)
{
// don't throw for 'failed' non-blocking IO
if
(
errno
==
EAGAIN
||
errno
==
EWOULDBLOCK
)
{
if
(
is_nonblock
&&
(
errno
==
EAGAIN
||
errno
==
EWOULDBLOCK
))
{
}
return
;
// don't throw, just try again
else
throw_io_failure
(
msg
);
}
}
throw_io_failure
(
"cannot write to file descriptor"
);
}
}
}
}
void
handle_read_result
(
ssize_t
result
,
bool
is_nonblocking_io
)
{
void
handle_write_result
(
ssize_t
res
,
bool
is_nonblock
)
{
handle_write_result
(
result
,
is_nonblocking_io
);
handle_io_result
(
res
,
is_nonblock
,
"cannot write to file descriptor"
);
if
(
result
==
0
)
{
}
throw_io_failure
(
"cannot read from closed socket / file handle"
);
}
void
handle_read_result
(
ssize_t
res
,
bool
is_nonblock
)
{
handle_io_result
(
res
,
is_nonblock
,
"cannot read from file descriptor"
);
if
(
res
==
0
)
throw_io_failure
(
"cannot read from closed file descriptor"
);
}
}
}
}
}
// namespace cppa::detail::fd_util
}
}
}
// namespace cppa::detail::fd_util
...
...
Write
Preview
Markdown
is supported
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