summaryrefslogtreecommitdiffstats
path: root/net/base/winsock_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/base/winsock_util.cc')
-rw-r--r--net/base/winsock_util.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/base/winsock_util.cc b/net/base/winsock_util.cc
index 02f59d6..8a4083a 100644
--- a/net/base/winsock_util.cc
+++ b/net/base/winsock_util.cc
@@ -30,6 +30,8 @@ void CheckEventWait(WSAEVENT hEvent, DWORD wait_rv, DWORD expected) {
#pragma optimize( "", on )
#pragma warning (default: 4748)
+net::PlatformSocketFactory* g_socket_factory = NULL;
+
} // namespace
void AssertEventNotSignaled(WSAEVENT hEvent) {
@@ -48,4 +50,15 @@ bool ResetEventIfSignaled(WSAEVENT hEvent) {
return true;
}
+void PlatformSocketFactory::SetInstance(PlatformSocketFactory* factory) {
+ g_socket_factory = factory;
+}
+
+SOCKET CreatePlatformSocket(int family, int type, int protocol) {
+ if (g_socket_factory)
+ return g_socket_factory->CreateSocket(family, type, protocol);
+ else
+ return ::WSASocket(family, type, protocol, NULL, 0, WSA_FLAG_OVERLAPPED);
+}
+
} // namespace net