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
c39c2eae
Commit
c39c2eae
authored
Jun 01, 2019
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add function to generate string from socket err
parent
41547a86
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
libcaf_io/caf/io/network/native_socket.hpp
libcaf_io/caf/io/network/native_socket.hpp
+3
-0
libcaf_io/src/native_socket.cpp
libcaf_io/src/native_socket.cpp
+11
-3
No files found.
libcaf_io/caf/io/network/native_socket.hpp
View file @
c39c2eae
...
...
@@ -79,6 +79,9 @@ bool would_block_or_temporarily_unavailable(int errcode);
/// Returns the last socket error as human-readable string.
std
::
string
last_socket_error_as_string
();
/// Returns a human-readable string for a given socket error.
std
::
string
socket_error_as_string
(
int
errcode
);
/// Creates two connected sockets. The former is the read handle
/// and the latter is the write handle.
std
::
pair
<
native_socket
,
native_socket
>
create_pipe
();
...
...
libcaf_io/src/native_socket.cpp
View file @
c39c2eae
...
...
@@ -125,6 +125,11 @@ namespace network {
return
strerror
(
errno
);
}
string
socket_error_as_string
(
int
errcode
)
{
return
strerror
(
errcode
);
}
expected
<
void
>
child_process_inherit
(
native_socket
fd
,
bool
new_value
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
fd
)
<<
CAF_ARG
(
new_value
));
// read flags for fd
...
...
@@ -187,9 +192,12 @@ namespace network {
}
string
last_socket_error_as_string
()
{
return
socket_error_as_string
(
last_socket_error
());
}
string
socket_error_as_string
(
int
errcode
)
{
LPTSTR
errorText
=
NULL
;
auto
hresult
=
last_socket_error
();
FormatMessage
(
// use system message tables to retrieve error text
FormatMessage
(
// use system message tables to retrieve error text
FORMAT_MESSAGE_FROM_SYSTEM
// allocate buffer on local heap for error text
|
FORMAT_MESSAGE_ALLOCATE_BUFFER
...
...
@@ -197,7 +205,7 @@ namespace network {
// (and CANNOT) pass insertion parameters
|
FORMAT_MESSAGE_IGNORE_INSERTS
,
nullptr
,
// unused with FORMAT_MESSAGE_FROM_SYSTEM
hresult
,
MAKELANGID
(
LANG_NEUTRAL
,
SUBLANG_DEFAULT
),
errcode
,
MAKELANGID
(
LANG_NEUTRAL
,
SUBLANG_DEFAULT
),
(
LPTSTR
)
&
errorText
,
// output
0
,
// minimum size for output buffer
nullptr
);
// arguments - see note
...
...
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