Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
4d228e66
Unverified
Commit
4d228e66
authored
Sep 13, 2018
by
Rémi Verschelde
Committed by
GitHub
Sep 13, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #22030 from Faless/sockets_fixes
Properly initialize Winsock on startup
parents
68f224a5
01c3c1a0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
1 deletion
+24
-1
net_socket_posix.cpp
drivers/unix/net_socket_posix.cpp
+18
-1
net_socket_posix.h
drivers/unix/net_socket_posix.h
+1
-0
os_unix.cpp
drivers/unix/os_unix.cpp
+2
-0
os_uwp.cpp
platform/uwp/os_uwp.cpp
+2
-0
os_windows.cpp
platform/windows/os_windows.cpp
+1
-0
No files found.
drivers/unix/net_socket_posix.cpp
View file @
4d228e66
...
...
@@ -150,9 +150,24 @@ NetSocket *NetSocketPosix::_create_func() {
}
void
NetSocketPosix
::
make_default
()
{
#if defined(WINDOWS_ENABLED)
if
(
_create
==
NULL
)
{
WSADATA
data
;
WSAStartup
(
MAKEWORD
(
2
,
2
),
&
data
);
}
#endif
_create
=
_create_func
;
}
void
NetSocketPosix
::
cleanup
()
{
#if defined(WINDOWS_ENABLED)
if
(
_create
!=
NULL
)
{
WSACleanup
();
}
_create
=
NULL
;
#endif
}
NetSocketPosix
::
NetSocketPosix
()
{
_sock
=
SOCK_EMPTY
;
_ip_type
=
IP
::
TYPE_NONE
;
...
...
@@ -169,10 +184,11 @@ NetSocketPosix::NetError NetSocketPosix::_get_socket_error() {
if
(
err
==
WSAEISCONN
)
return
ERR_NET_IS_CONNECTED
;
if
(
err
==
WSAEINPROGRESS
||
err
no
==
WSAEALREADY
)
if
(
err
==
WSAEINPROGRESS
||
err
==
WSAEALREADY
)
return
ERR_NET_IN_PROGRESS
;
if
(
err
==
WSAEWOULDBLOCK
)
return
ERR_NET_WOULD_BLOCK
;
ERR_PRINTS
(
"Socket error: "
+
itos
(
err
));
return
ERR_NET_OTHER
;
#else
if
(
errno
==
EISCONN
)
...
...
@@ -181,6 +197,7 @@ NetSocketPosix::NetError NetSocketPosix::_get_socket_error() {
return
ERR_NET_IN_PROGRESS
;
if
(
errno
==
EAGAIN
||
errno
==
EWOULDBLOCK
)
return
ERR_NET_WOULD_BLOCK
;
ERR_PRINTS
(
"Socket error: "
+
itos
(
errno
));
return
ERR_NET_OTHER
;
#endif
}
...
...
drivers/unix/net_socket_posix.h
View file @
4d228e66
...
...
@@ -67,6 +67,7 @@ protected:
public
:
static
void
make_default
();
static
void
cleanup
();
virtual
Error
open
(
Type
p_sock_type
,
IP
::
Type
&
ip_type
);
virtual
void
close
();
...
...
drivers/unix/os_unix.cpp
View file @
4d228e66
...
...
@@ -139,6 +139,8 @@ void OS_Unix::initialize_core() {
}
void
OS_Unix
::
finalize_core
()
{
NetSocketPosix
::
cleanup
();
}
void
OS_Unix
::
alert
(
const
String
&
p_alert
,
const
String
&
p_title
)
{
...
...
platform/uwp/os_uwp.cpp
View file @
4d228e66
...
...
@@ -406,6 +406,8 @@ void OSUWP::finalize() {
}
void
OSUWP
::
finalize_core
()
{
NetSocketPosix
::
cleanup
();
}
void
OSUWP
::
alert
(
const
String
&
p_alert
,
const
String
&
p_title
)
{
...
...
platform/windows/os_windows.cpp
View file @
4d228e66
...
...
@@ -1512,6 +1512,7 @@ void OS_Windows::finalize_core() {
timeEndPeriod
(
1
);
memdelete
(
process_map
);
NetSocketPosix
::
cleanup
();
}
void
OS_Windows
::
alert
(
const
String
&
p_alert
,
const
String
&
p_title
)
{
...
...
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