Skip to content

Commit

Permalink
[Socket] Add missing EnsureWSAStartup
Browse files Browse the repository at this point in the history
Signed-off-by: LFsWang <[email protected]>
  • Loading branch information
LFsWang authored and hydai committed May 6, 2022
1 parent efa3d0c commit 523fbab
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/host/wasi/inode-win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ WasiExpect<void> INode::sockGetOpt(__wasi_sock_opt_level_t SockOptLevel,
__wasi_sock_opt_so_t SockOptName,
void *FlagPtr,
uint32_t *FlagSizePtr) const noexcept {
EnsureWSAStartup();
auto SysSockOptLevel = toSockOptLevel(SockOptLevel);
auto SysSockOptName = toSockOptSoName(SockOptName);
auto UnsafeFlagSizePtr = reinterpret_cast<int *>(FlagSizePtr);
Expand Down Expand Up @@ -607,6 +608,7 @@ WasiExpect<void> INode::sockSetOpt(__wasi_sock_opt_level_t SockOptLevel,
__wasi_sock_opt_so_t SockOptName,
void *FlagPtr,
uint32_t FlagSize) const noexcept {
EnsureWSAStartup();
auto SysSockOptLevel = toSockOptLevel(SockOptLevel);
auto SysSockOptName = toSockOptSoName(SockOptName);
char *CFlagPtr = static_cast<char *>(FlagPtr);
Expand All @@ -624,6 +626,7 @@ WasiExpect<void> INode::sockSetOpt(__wasi_sock_opt_level_t SockOptLevel,
WasiExpect<void> INode::sockGetLoaclAddr(uint8_t *AddressPtr,
uint32_t *AddrTypePtr,
uint32_t *PortPtr) const noexcept {
EnsureWSAStartup();
struct sockaddr_storage SocketAddr;
socklen_t Slen = sizeof(SocketAddr);
std::memset(&SocketAddr, 0, sizeof(SocketAddr));
Expand Down Expand Up @@ -658,6 +661,7 @@ WasiExpect<void> INode::sockGetLoaclAddr(uint8_t *AddressPtr,

WasiExpect<void> INode::sockGetPeerAddr(uint8_t *, uint32_t *,
uint32_t *) const noexcept {
EnsureWSAStartup();
return WasiUnexpect(__WASI_ERRNO_NOSYS);
}

Expand Down

0 comments on commit 523fbab

Please sign in to comment.