Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
be6317e6
Commit
be6317e6
authored
10 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
fix build for Win32
parent
017cda7a
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
configure.ac
+27
-0
27 additions, 0 deletions
configure.ac
include/opendht/dhtrunner.h
+2
-4
2 additions, 4 deletions
include/opendht/dhtrunner.h
src/dhtrunner.cpp
+24
-0
24 additions, 0 deletions
src/dhtrunner.cpp
with
53 additions
and
4 deletions
configure.ac
+
27
−
0
View file @
be6317e6
...
@@ -3,6 +3,7 @@ AC_CONFIG_AUX_DIR(ac)
...
@@ -3,6 +3,7 @@ AC_CONFIG_AUX_DIR(ac)
AM_INIT_AUTOMAKE([foreign])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Build in debug mode, adds stricter warnings, disables optimization]))
AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Build in debug mode, adds stricter warnings, disables optimization]))
AS_IF([test "x$enable_debug" = "xyes"],
AS_IF([test "x$enable_debug" = "xyes"],
...
@@ -13,6 +14,32 @@ AC_PROG_CC
...
@@ -13,6 +14,32 @@ AC_PROG_CC
AC_PROG_CXX
AC_PROG_CXX
AM_PROG_AR
AM_PROG_AR
case "${host_os}" in
"")
SYS=unknown
;;
linux*)
SYS=linux
;;
darwin*)
SYS=darwin
;;
mingw32*)
SYS=mingw32
AC_DEFINE([_POSIX_SOURCE], [1], [IEEE Std 1003.1.])
AC_DEFINE([_POSIX_C_SOURCE], [200809L], [IEEE Std 1003.1.])
AC_DEFINE([_XOPEN_SOURCE], [700], [POSIX and XPG 7th edition])
AC_DEFINE([_XOPEN_SOURCE_EXTENDED], [1], [XPG things and X/Open Unix extensions.])
AC_DEFINE([_BSD_SOURCE], [1], [ISO C, POSIX, and 4.3BSD things.])
LDFLAGS="${LDFLAGS} -lws2_32"
AC_SUBST(WINDOWS_ARCH)
AC_SUBST(PROGRAMFILES)
;;
*)
SYS="${host_os}"
;;
esac
LT_INIT()
LT_INIT()
LT_LANG(C++)
LT_LANG(C++)
...
...
This diff is collapsed.
Click to expand it.
include/opendht/dhtrunner.h
+
2
−
4
View file @
be6317e6
...
@@ -54,10 +54,8 @@ class DhtRunner {
...
@@ -54,10 +54,8 @@ class DhtRunner {
public:
public:
typedef
std
::
function
<
void
(
Dht
::
Status
,
Dht
::
Status
)
>
StatusCallback
;
typedef
std
::
function
<
void
(
Dht
::
Status
,
Dht
::
Status
)
>
StatusCallback
;
DhtRunner
()
{}
DhtRunner
();
virtual
~
DhtRunner
()
{
virtual
~
DhtRunner
();
join
();
}
void
get
(
InfoHash
hash
,
Dht
::
GetCallback
vcb
,
Dht
::
DoneCallback
dcb
=
nullptr
,
Value
::
Filter
f
=
Value
::
AllFilter
());
void
get
(
InfoHash
hash
,
Dht
::
GetCallback
vcb
,
Dht
::
DoneCallback
dcb
=
nullptr
,
Value
::
Filter
f
=
Value
::
AllFilter
());
void
get
(
const
std
::
string
&
key
,
Dht
::
GetCallback
vcb
,
Dht
::
DoneCallback
dcb
=
nullptr
,
Value
::
Filter
f
=
Value
::
AllFilter
());
void
get
(
const
std
::
string
&
key
,
Dht
::
GetCallback
vcb
,
Dht
::
DoneCallback
dcb
=
nullptr
,
Value
::
Filter
f
=
Value
::
AllFilter
());
...
...
This diff is collapsed.
Click to expand it.
src/dhtrunner.cpp
+
24
−
0
View file @
be6317e6
...
@@ -32,8 +32,32 @@
...
@@ -32,8 +32,32 @@
#include
<unistd.h>
// close(fd)
#include
<unistd.h>
// close(fd)
#ifndef _WIN32
#include
<sys/socket.h>
#else
#include
<winsock2.h>
#include
<ws2tcpip.h>
#endif
namespace
dht
{
namespace
dht
{
DhtRunner
::
DhtRunner
()
{
#ifdef _WIN32
WSADATA
wsd
;
if
(
WSAStartup
(
MAKEWORD
(
2
,
2
),
&
wsd
)
!=
0
)
throw
DhtException
(
"Can't initialize Winsock2"
);
#endif
}
DhtRunner
::~
DhtRunner
()
{
join
();
#ifdef _WIN32
WSACleanup
();
#endif
}
void
void
DhtRunner
::
run
(
in_port_t
port
,
const
crypto
::
Identity
identity
,
bool
threaded
,
StatusCallback
cb
)
DhtRunner
::
run
(
in_port_t
port
,
const
crypto
::
Identity
identity
,
bool
threaded
,
StatusCallback
cb
)
{
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment