Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
fc5f8768
Commit
fc5f8768
authored
Apr 21, 2017
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32Socketpair() shouldn't just fail if setupAsyncIo() hasn't been called
parent
14589b38
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
async-io-win32.c++
c++/src/kj/async-io-win32.c++
+17
-5
No files found.
c++/src/kj/async-io-win32.c++
View file @
fc5f8768
...
...
@@ -49,6 +49,20 @@ namespace kj {
namespace
_
{
// private
struct
WinsockInitializer
{
WinsockInitializer
()
{
WSADATA
dontcare
;
int
result
=
WSAStartup
(
MAKEWORD
(
2
,
2
),
&
dontcare
);
if
(
result
!=
0
)
{
KJ_FAIL_WIN32
(
"WSAStartup()"
,
result
);
}
}
};
void
initWinsockOnce
()
{
static
WinsockInitializer
initializer
;
}
int
win32Socketpair
(
SOCKET
socks
[
2
])
{
// This function from: https://github.com/ncm/selectable-socketpair/blob/master/socketpair.c
//
...
...
@@ -84,6 +98,8 @@ int win32Socketpair(SOCKET socks[2]) {
// TODO(cleanup): Consider putting this somewhere public? Note that since it depends on Winsock,
// it needs to be in the kj-async library.
initWinsockOnce
();
union
{
struct
sockaddr_in
inaddr
;
struct
sockaddr
addr
;
...
...
@@ -1116,11 +1132,7 @@ Own<AsyncIoProvider> newAsyncIoProvider(LowLevelAsyncIoProvider& lowLevel) {
}
AsyncIoContext
setupAsyncIo
()
{
WSADATA
dontcare
;
int
result
=
WSAStartup
(
MAKEWORD
(
2
,
2
),
&
dontcare
);
if
(
result
!=
0
)
{
KJ_FAIL_WIN32
(
"WSAStartup()"
,
result
);
}
_
::
initWinsockOnce
();
auto
lowLevel
=
heap
<
LowLevelAsyncIoProviderImpl
>
();
auto
ioProvider
=
kj
::
heap
<
AsyncIoProviderImpl
>
(
*
lowLevel
);
...
...
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