Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
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
libzmq
Commits
f895426c
Commit
f895426c
authored
Sep 07, 2009
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial changes for win port
parent
87ccbb9f
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
765 additions
and
25 deletions
+765
-25
zmq.h
include/zmq.h
+3
-2
libzmq.vcproj
msvc/libzmq/libzmq.vcproj
+520
-0
msvc.sln
msvc/msvc.sln
+20
-0
platform.hpp
msvc/platform.hpp
+59
-0
app_thread.cpp
src/app_thread.cpp
+2
-0
fd_signaler.cpp
src/fd_signaler.cpp
+1
-0
options.hpp
src/options.hpp
+2
-0
pipe.cpp
src/pipe.cpp
+1
-3
tcp_connecter.cpp
src/tcp_connecter.cpp
+73
-2
tcp_listener.cpp
src/tcp_listener.cpp
+0
-1
tcp_socket.cpp
src/tcp_socket.cpp
+71
-4
uuid.cpp
src/uuid.cpp
+8
-5
uuid.hpp
src/uuid.hpp
+4
-7
zmq_connecter.cpp
src/zmq_connecter.cpp
+1
-1
No files found.
include/zmq.h
View file @
f895426c
...
@@ -25,7 +25,6 @@ extern "C" {
...
@@ -25,7 +25,6 @@ extern "C" {
#endif
#endif
#include <stddef.h>
#include <stddef.h>
#include <stdint.h>
#if defined MSC_VER && defined ZMQ_BUILDING_LIBZMQ
#if defined MSC_VER && defined ZMQ_BUILDING_LIBZMQ
#define ZMQ_EXPORT __declspec(dllexport)
#define ZMQ_EXPORT __declspec(dllexport)
...
@@ -35,6 +34,8 @@ extern "C" {
...
@@ -35,6 +34,8 @@ extern "C" {
// Maximal size of "Very Small Message". VSMs are passed by value
// Maximal size of "Very Small Message". VSMs are passed by value
// to avoid excessive memory allocation/deallocation.
// to avoid excessive memory allocation/deallocation.
// If VMSs larger than 255 bytes are required, type of 'vsm_size'
// field in zmq_msg_t structure should be modified accordingly.
#define ZMQ_MAX_VSM_SIZE 30
#define ZMQ_MAX_VSM_SIZE 30
// Message & notification types.
// Message & notification types.
...
@@ -98,7 +99,7 @@ struct zmq_msg_t
...
@@ -98,7 +99,7 @@ struct zmq_msg_t
{
{
void
*
content
;
void
*
content
;
unsigned
char
shared
;
unsigned
char
shared
;
u
int16_t
vsm_size
;
u
nsigned
char
vsm_size
;
unsigned
char
vsm_data
[
ZMQ_MAX_VSM_SIZE
];
unsigned
char
vsm_data
[
ZMQ_MAX_VSM_SIZE
];
};
};
...
...
msvc/libzmq/libzmq.vcproj
0 → 100644
View file @
f895426c
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType=
"Visual C++"
Version=
"9.00"
Name=
"libzmq"
ProjectGUID=
"{641C5F36-32EE-4323-B740-992B651CF9D6}"
RootNamespace=
"libzmq"
TargetFrameworkVersion=
"196613"
>
<Platforms>
<Platform
Name=
"Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name=
"Debug|Win32"
OutputDirectory=
"$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory=
"$(ConfigurationName)"
ConfigurationType=
"1"
CharacterSet=
"2"
>
<Tool
Name=
"VCPreBuildEventTool"
CommandLine=
"copy ..\platform.hpp ..\..\src"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCCLCompilerTool"
Optimization=
"0"
MinimalRebuild=
"true"
BasicRuntimeChecks=
"3"
RuntimeLibrary=
"3"
WarningLevel=
"3"
DebugInformationFormat=
"4"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLinkerTool"
GenerateDebugInformation=
"true"
TargetMachine=
"1"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCManifestTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCAppVerifierTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name=
"Release|Win32"
OutputDirectory=
"$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory=
"$(ConfigurationName)"
ConfigurationType=
"1"
CharacterSet=
"2"
WholeProgramOptimization=
"1"
>
<Tool
Name=
"VCPreBuildEventTool"
CommandLine=
"copy ..\platform.hpp ..\..\src"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCCLCompilerTool"
Optimization=
"2"
EnableIntrinsicFunctions=
"true"
RuntimeLibrary=
"2"
EnableFunctionLevelLinking=
"true"
WarningLevel=
"3"
DebugInformationFormat=
"3"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLinkerTool"
GenerateDebugInformation=
"true"
OptimizeReferences=
"2"
EnableCOMDATFolding=
"2"
TargetMachine=
"1"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCManifestTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCAppVerifierTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name=
"Source Files"
Filter=
"cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier=
"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=
"..\..\src\app_thread.cpp"
>
</File>
<File
RelativePath=
"..\..\src\devpoll.cpp"
>
</File>
<File
RelativePath=
"..\..\src\dispatcher.cpp"
>
</File>
<File
RelativePath=
"..\..\src\epoll.cpp"
>
</File>
<File
RelativePath=
"..\..\src\err.cpp"
>
</File>
<File
RelativePath=
"..\..\src\fd_signaler.cpp"
>
</File>
<File
RelativePath=
"..\..\src\io_object.cpp"
>
</File>
<File
RelativePath=
"..\..\src\io_thread.cpp"
>
</File>
<File
RelativePath=
"..\..\src\ip.cpp"
>
</File>
<File
RelativePath=
"..\..\src\kqueue.cpp"
>
</File>
<File
RelativePath=
"..\..\src\object.cpp"
>
</File>
<File
RelativePath=
"..\..\src\options.cpp"
>
</File>
<File
RelativePath=
"..\..\src\owned.cpp"
>
</File>
<File
RelativePath=
"..\..\src\pipe.cpp"
>
</File>
<File
RelativePath=
"..\..\src\poll.cpp"
>
</File>
<File
RelativePath=
"..\..\src\select.cpp"
>
</File>
<File
RelativePath=
"..\..\src\session.cpp"
>
</File>
<File
RelativePath=
"..\..\src\socket_base.cpp"
>
</File>
<File
RelativePath=
"..\..\src\tcp_connecter.cpp"
>
</File>
<File
RelativePath=
"..\..\src\tcp_listener.cpp"
>
</File>
<File
RelativePath=
"..\..\src\tcp_socket.cpp"
>
</File>
<File
RelativePath=
"..\..\src\thread.cpp"
>
</File>
<File
RelativePath=
"..\..\src\uuid.cpp"
>
</File>
<File
RelativePath=
"..\..\src\ypollset.cpp"
>
</File>
<File
RelativePath=
"..\..\src\zmq.cpp"
>
</File>
<File
RelativePath=
"..\..\src\zmq_connecter.cpp"
>
</File>
<File
RelativePath=
"..\..\src\zmq_connecter_init.cpp"
>
</File>
<File
RelativePath=
"..\..\src\zmq_decoder.cpp"
>
</File>
<File
RelativePath=
"..\..\src\zmq_encoder.cpp"
>
</File>
<File
RelativePath=
"..\..\src\zmq_engine.cpp"
>
</File>
<File
RelativePath=
"..\..\src\zmq_listener.cpp"
>
</File>
<File
RelativePath=
"..\..\src\zmq_listener_init.cpp"
>
</File>
</Filter>
<Filter
Name=
"Header Files"
Filter=
"h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier=
"{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=
"..\..\src\app_thread.hpp"
>
</File>
<File
RelativePath=
"..\..\src\atomic_bitmap.hpp"
>
</File>
<File
RelativePath=
"..\..\src\atomic_counter.hpp"
>
</File>
<File
RelativePath=
"..\..\src\atomic_ptr.hpp"
>
</File>
<File
RelativePath=
"..\..\src\command.hpp"
>
</File>
<File
RelativePath=
"..\..\src\config.hpp"
>
</File>
<File
RelativePath=
"..\..\src\decoder.hpp"
>
</File>
<File
RelativePath=
"..\..\src\devpoll.hpp"
>
</File>
<File
RelativePath=
"..\..\src\dispatcher.hpp"
>
</File>
<File
RelativePath=
"..\..\src\encoder.hpp"
>
</File>
<File
RelativePath=
"..\..\src\epoll.hpp"
>
</File>
<File
RelativePath=
"..\..\src\err.hpp"
>
</File>
<File
RelativePath=
"..\..\src\fd.hpp"
>
</File>
<File
RelativePath=
"..\..\src\fd_signaler.hpp"
>
</File>
<File
RelativePath=
"..\..\src\i_endpoint.hpp"
>
</File>
<File
RelativePath=
"..\..\src\i_engine.hpp"
>
</File>
<File
RelativePath=
"..\..\src\i_inout.hpp"
>
</File>
<File
RelativePath=
"..\..\src\i_poll_events.hpp"
>
</File>
<File
RelativePath=
"..\..\src\i_poller.hpp"
>
</File>
<File
RelativePath=
"..\..\src\i_signaler.hpp"
>
</File>
<File
RelativePath=
"..\..\src\io_object.hpp"
>
</File>
<File
RelativePath=
"..\..\src\io_thread.hpp"
>
</File>
<File
RelativePath=
"..\..\src\ip.hpp"
>
</File>
<File
RelativePath=
"..\..\src\kqueue.hpp"
>
</File>
<File
RelativePath=
"..\..\src\msg_content.hpp"
>
</File>
<File
RelativePath=
"..\..\src\mutex.hpp"
>
</File>
<File
RelativePath=
"..\..\src\object.hpp"
>
</File>
<File
RelativePath=
"..\..\src\options.hpp"
>
</File>
<File
RelativePath=
"..\..\src\owned.hpp"
>
</File>
<File
RelativePath=
"..\..\src\pipe.hpp"
>
</File>
<File
RelativePath=
"..\platform.hpp"
>
</File>
<File
RelativePath=
"..\..\src\poll.hpp"
>
</File>
<File
RelativePath=
"..\..\src\select.hpp"
>
</File>
<File
RelativePath=
"..\..\src\session.hpp"
>
</File>
<File
RelativePath=
"..\..\src\simple_semaphore.hpp"
>
</File>
<File
RelativePath=
"..\..\src\socket_base.hpp"
>
</File>
<File
RelativePath=
"..\..\src\stdint.hpp"
>
</File>
<File
RelativePath=
"..\..\src\tcp_connecter.hpp"
>
</File>
<File
RelativePath=
"..\..\src\tcp_listener.hpp"
>
</File>
<File
RelativePath=
"..\..\src\tcp_socket.hpp"
>
</File>
<File
RelativePath=
"..\..\src\thread.hpp"
>
</File>
<File
RelativePath=
"..\..\src\uuid.hpp"
>
</File>
<File
RelativePath=
"..\..\src\windows.hpp"
>
</File>
<File
RelativePath=
"..\..\src\wire.hpp"
>
</File>
<File
RelativePath=
"..\..\src\ypipe.hpp"
>
</File>
<File
RelativePath=
"..\..\src\ypollset.hpp"
>
</File>
<File
RelativePath=
"..\..\src\yqueue.hpp"
>
</File>
<File
RelativePath=
"..\..\src\zmq_connecter.hpp"
>
</File>
<File
RelativePath=
"..\..\src\zmq_connecter_init.hpp"
>
</File>
<File
RelativePath=
"..\..\src\zmq_decoder.hpp"
>
</File>
<File
RelativePath=
"..\..\src\zmq_encoder.hpp"
>
</File>
<File
RelativePath=
"..\..\src\zmq_engine.hpp"
>
</File>
<File
RelativePath=
"..\..\src\zmq_listener.hpp"
>
</File>
<File
RelativePath=
"..\..\src\zmq_listener_init.hpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
msvc/msvc.sln
0 → 100644
View file @
f895426c
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzmq", "libzmq\libzmq.vcproj", "{641C5F36-32EE-4323-B740-992B651CF9D6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{641C5F36-32EE-4323-B740-992B651CF9D6}.Debug|Win32.ActiveCfg = Debug|Win32
{641C5F36-32EE-4323-B740-992B651CF9D6}.Debug|Win32.Build.0 = Debug|Win32
{641C5F36-32EE-4323-B740-992B651CF9D6}.Release|Win32.ActiveCfg = Release|Win32
{641C5F36-32EE-4323-B740-992B651CF9D6}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
msvc/platform.hpp
0 → 100644
View file @
f895426c
/*
Copyright (c) 2007-2009 FastMQ Inc.
This file is part of 0MQ.
0MQ is free software; you can redistribute it and/or modify it under
the terms of the Lesser GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
0MQ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Lesser GNU General Public License for more details.
You should have received a copy of the Lesser GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ZMQ_PLATFORM_HPP_INCLUDED__
#define __ZMQ_PLATFORM_HPP_INCLUDED__
// This is the platform definition for the Windows platform.
// As a first step of the build process it is copied to
// zmq directory to take place of platform.hpp generated from
// platform.hpp.in on platforms supported by GNU autotools.
#define ZMQ_HAVE_WINDOWS
#define _WINSOCKAPI_
#define NOMINMAX
#define _CRT_SECURE_NO_WARNINGS
// Turn on only the items zmq needs on the Windows platform.
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef NOMCX // No Modem Configuration Extensions.
#define NOMCX
#endif
#ifndef NOIME // No Input Method Editor.
#define NOIME
#endif
#ifndef NOSOUND // No Sound driver routines.
#define NOSOUND
#endif
#include <windows.h>
#include <objbase.h>
// Enable winsock (not included when WIN32_LEAN_AND_MEAN is defined).
#if(_WIN32_WINNT >= 0x0400)
#include <winsock2.h>
#include <mswsock.h>
#else
#include <winsock.h>
#endif
#endif
src/app_thread.cpp
View file @
f895426c
...
@@ -21,6 +21,8 @@
...
@@ -21,6 +21,8 @@
#include "../include/zmq.h"
#include "../include/zmq.h"
#include "platform.hpp"
#if defined ZMQ_HAVE_WINDOWS
#if defined ZMQ_HAVE_WINDOWS
#include "windows.hpp"
#include "windows.hpp"
#else
#else
...
...
src/fd_signaler.cpp
View file @
f895426c
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "platform.hpp"
#include "platform.hpp"
#include "err.hpp"
#include "err.hpp"
#include "fd.hpp"
#include "fd.hpp"
#include "ip.hpp"
#if defined ZMQ_HAVE_OPENVMS
#if defined ZMQ_HAVE_OPENVMS
#include <netinet/tcp.h>
#include <netinet/tcp.h>
...
...
src/options.hpp
View file @
f895426c
...
@@ -22,6 +22,8 @@
...
@@ -22,6 +22,8 @@
#include <string>
#include <string>
#include "stdint.hpp"
namespace
zmq
namespace
zmq
{
{
...
...
src/pipe.cpp
View file @
f895426c
...
@@ -17,9 +17,7 @@
...
@@ -17,9 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include <pthread.h>
#include "../include/zmq.h"
#include <../include/zmq.h>
#include "pipe.hpp"
#include "pipe.hpp"
...
...
src/tcp_connecter.cpp
View file @
f895426c
...
@@ -26,8 +26,79 @@
...
@@ -26,8 +26,79 @@
#ifdef ZMQ_HAVE_WINDOWS
#ifdef ZMQ_HAVE_WINDOWS
#include "windows.hpp"
zmq
::
tcp_connecter_t
::
tcp_connecter_t
()
:
#error
s
(
retired_fd
)
{
memset
(
&
addr
,
0
,
sizeof
(
addr
));
}
zmq
::
tcp_connecter_t
::~
tcp_connecter_t
()
{
if
(
s
!=
retired_fd
)
close
();
}
int
zmq
::
tcp_connecter_t
::
set_address
(
const
char
*
addr_
)
{
// Convert the hostname into sockaddr_in structure.
return
resolve_ip_hostname
(
&
addr
,
addr_
);
}
int
zmq
::
tcp_connecter_t
::
open
()
{
zmq_assert
(
s
==
retired_fd
);
// Create the socket.
s
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
// TODO: Convert error to errno.
wsa_assert
(
s
!=
INVALID_SOCKET
);
// Set to non-blocking mode.
unsigned
long
argp
=
1
;
int
rc
=
ioctlsocket
(
s
,
FIONBIO
,
&
argp
);
wsa_assert
(
rc
!=
SOCKET_ERROR
);
// Disable Nagle's algorithm.
int
flag
=
1
;
rc
=
setsockopt
(
s
,
IPPROTO_TCP
,
TCP_NODELAY
,
(
char
*
)
&
flag
,
sizeof
(
int
));
wsa_assert
(
rc
!=
SOCKET_ERROR
);
// Connect to the remote peer.
rc
=
::
connect
(
s
,
(
sockaddr
*
)
&
addr
,
sizeof
addr
);
// Connect was successfull immediately.
if
(
rc
==
0
)
return
0
;
// Asynchronous connect was launched.
if
(
rc
==
SOCKET_ERROR
&&
(
WSAGetLastError
()
==
WSAEINPROGRESS
||
WSAGetLastError
()
==
WSAEWOULDBLOCK
))
{
errno
=
EAGAIN
;
return
-
1
;
}
// TODO: Convert error to errno.
wsa_assert
(
rc
==
0
);
return
-
1
;
}
int
zmq
::
tcp_connecter_t
::
close
()
{
zmq_assert
(
s
!=
retired_fd
);
int
rc
=
closesocket
(
s
);
wsa_assert
(
rc
!=
SOCKET_ERROR
);
s
=
retired_fd
;
return
0
;
}
zmq
::
fd_t
zmq
::
tcp_connecter_t
::
get_fd
()
{
return
s
;
}
// connect
#else
#else
...
...
src/tcp_listener.cpp
View file @
f895426c
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
#ifdef ZMQ_HAVE_WINDOWS
#ifdef ZMQ_HAVE_WINDOWS
#include "windows.hpp"
#error
#error
#else
#else
...
...
src/tcp_socket.cpp
View file @
f895426c
...
@@ -23,8 +23,75 @@
...
@@ -23,8 +23,75 @@
#ifdef ZMQ_HAVE_WINDOWS
#ifdef ZMQ_HAVE_WINDOWS
#include "windows.hpp"
zmq
::
tcp_socket_t
::
tcp_socket_t
()
:
#error
s
(
retired_fd
)
{
}
zmq
::
tcp_socket_t
::~
tcp_socket_t
()
{
if
(
s
!=
retired_fd
)
close
();
}
int
zmq
::
tcp_socket_t
::
open
(
fd_t
fd_
)
{
zmq_assert
(
s
==
retired_fd
);
s
=
fd_
;
return
0
;
}
int
zmq
::
tcp_socket_t
::
close
()
{
zmq_assert
(
s
!=
retired_fd
);
int
rc
=
closesocket
(
s
);
wsa_assert
(
rc
!=
SOCKET_ERROR
);
s
=
retired_fd
;
return
0
;
}
int
zmq
::
tcp_socket_t
::
write
(
const
void
*
data
,
int
size
)
{
int
nbytes
=
send
(
s
,
(
char
*
)
data
,
size
,
0
);
// If not a single byte can be written to the socket in non-blocking mode
// we'll get an error (this may happen during the speculative write).
if
(
nbytes
==
SOCKET_ERROR
&&
WSAGetLastError
()
==
WSAEWOULDBLOCK
)
return
0
;
// Signalise peer failure.
if
(
nbytes
==
SOCKET_ERROR
&&
WSAGetLastError
()
==
WSAECONNRESET
)
return
-
1
;
wsa_assert
(
nbytes
!=
SOCKET_ERROR
);
return
(
size_t
)
nbytes
;
}
int
zmq
::
tcp_socket_t
::
read
(
void
*
data
,
int
size
)
{
int
nbytes
=
recv
(
s
,
(
char
*
)
data
,
size
,
0
);
// If not a single byte can be read from the socket in non-blocking mode
// we'll get an error (this may happen during the speculative read).
if
(
nbytes
==
SOCKET_ERROR
&&
WSAGetLastError
()
==
WSAEWOULDBLOCK
)
return
0
;
// Connection failure.
if
(
nbytes
==
-
1
&&
(
WSAGetLastError
()
==
WSAECONNRESET
||
WSAGetLastError
()
==
WSAECONNREFUSED
||
WSAGetLastError
()
==
WSAENOTCONN
))
return
-
1
;
wsa_assert
(
nbytes
!=
SOCKET_ERROR
);
// Orderly shutdown by the other peer.
if
(
nbytes
==
0
)
return
-
1
;
return
(
size_t
)
nbytes
;
}
#else
#else
...
@@ -112,5 +179,4 @@ int zmq::tcp_socket_t::read (void *data, int size)
...
@@ -112,5 +179,4 @@ int zmq::tcp_socket_t::read (void *data, int size)
return
(
size_t
)
nbytes
;
return
(
size_t
)
nbytes
;
}
}
#endif
#endif
\ No newline at end of file
src/uuid.cpp
View file @
f895426c
...
@@ -23,25 +23,28 @@
...
@@ -23,25 +23,28 @@
#if defined ZMQ_HAVE_WINDOWS
#if defined ZMQ_HAVE_WINDOWS
#include <rpcdce.h>
zmq
::
uuid_t
::
uuid_t
()
zmq
::
uuid_t
::
uuid_t
()
{
{
RPC_STATUS
ret
=
UuidCreate
(
&
uuid
);
RPC_STATUS
ret
=
UuidCreate
(
&
uuid
);
zmq_assert
(
ret
==
RPC_S_OK
);
zmq_assert
(
ret
==
RPC_S_OK
);
ret
=
UuidToString
(
&
uuid
,
&
uuid_str
);
ret
=
UuidToString
(
&
uuid
,
&
uuid_str
);
zmq_assert
(
ret
==
RPC_S_OK
);
zmq_assert
(
ret
==
RPC_S_OK
);
/*
HRESULT hr = CoCreateGUID (&uuid);
zmq_assert (hr == S_OK);
int rc = StringFromGUID2 (uuid, uuid_str, 40);
zmq_assert (rc != 0);
*/
}
}
zmq
::
uuid_t
::~
uuid_t
()
zmq
::
uuid_t
::~
uuid_t
()
{
{
RPC_STATUS
ret
=
RpcStringFree
(
&
uuid_str
);
assert
(
ret
==
RPC_S_OK
);
}
}
const
char
*
zmq
::
uuid_t
::
to_string
()
const
char
*
zmq
::
uuid_t
::
to_string
()
{
{
return
uuid_str
;
return
(
char
*
)
uuid_str
;
}
}
#elif defined ZMQ_HAVE_FREEBSD
#elif defined ZMQ_HAVE_FREEBSD
...
...
src/uuid.hpp
View file @
f895426c
...
@@ -21,15 +21,12 @@
...
@@ -21,15 +21,12 @@
#define __ZMQ_UUID_HPP_INCLUDED__
#define __ZMQ_UUID_HPP_INCLUDED__
#include "platform.hpp"
#include "platform.hpp"
#include "stdint.hpp"
#if defined ZMQ_HAVE_WINDOWS
#if defined ZMQ_HAVE_FREEBSD
#include <rpcdce.h>
#elif defined ZMQ_HAVE_FREEBSD
#include <uuid.h>
#include <uuid.h>
#elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OSX
#elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OSX
#include <uuid/uuid.h>
#include <uuid/uuid.h>
#else
#include <stdint.h>
#endif
#endif
namespace
zmq
namespace
zmq
...
@@ -56,8 +53,8 @@ namespace zmq
...
@@ -56,8 +53,8 @@ namespace zmq
enum
{
uuid_string_len
=
36
};
enum
{
uuid_string_len
=
36
};
#if defined ZMQ_HAVE_WINDOWS
#if defined ZMQ_HAVE_WINDOWS
::
UUID
uuid
;
::
UUID
uuid
;
char
*
uuid_str
;
RPC_CSTR
uuid_str
;
#elif defined ZMQ_HAVE_FREEBSD
#elif defined ZMQ_HAVE_FREEBSD
::
uuid_t
uuid
;
::
uuid_t
uuid
;
char
*
uuid_str
;
char
*
uuid_str
;
...
...
src/zmq_connecter.cpp
View file @
f895426c
...
@@ -106,7 +106,7 @@ void zmq::zmq_connecter_t::start_connecting ()
...
@@ -106,7 +106,7 @@ void zmq::zmq_connecter_t::start_connecting ()
}
}
// Connection establishment may be dealyed. Poll for its completion.
// Connection establishment may be dealyed. Poll for its completion.
else
if
(
rc
==
-
1
&&
errno
==
E
INPROGRESS
)
{
else
if
(
rc
==
-
1
&&
errno
==
E
AGAIN
)
{
handle
=
add_fd
(
tcp_connecter
.
get_fd
());
handle
=
add_fd
(
tcp_connecter
.
get_fd
());
handle_valid
=
true
;
handle_valid
=
true
;
set_pollout
(
handle
);
set_pollout
(
handle
);
...
...
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