Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dhtnet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
dhtnet
Commits
8f7e1bde
Commit
8f7e1bde
authored
1 year ago
by
Andreas Traczyk
Browse files
Options
Downloads
Patches
Plain Diff
natpmp: use winsock poll on Windows
Change-Id: I7b4ee7d3bd2b409ad098515c2a9c61eb67ce0833
parent
2ef5b66c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/upnp/protocol/natpmp/nat_pmp.cpp
+14
-1
14 additions, 1 deletion
src/upnp/protocol/natpmp/nat_pmp.cpp
with
14 additions
and
1 deletion
src/upnp/protocol/natpmp/nat_pmp.cpp
+
14
−
1
View file @
8f7e1bde
...
...
@@ -17,7 +17,19 @@
#include
"nat_pmp.h"
#if HAVE_LIBNATPMP
#ifdef _WIN32
// On Windows we assume WSAStartup is called during DHT initialization
#include
<winsock2.h>
#include
<ws2tcpip.h>
#else
#include
<poll.h>
#endif
#ifdef _WIN32
#define _poll(fds, nfds, timeout) WSAPoll(fds, nfds, timeout)
#else
#define _poll(fds, nfds, timeout) poll(fds, nfds, timeout)
#endif
namespace
dhtnet
{
namespace
upnp
{
...
...
@@ -340,8 +352,9 @@ NatPmp::readResponse(natpmp_t& handle, natpmpresp_t& response)
struct
timeval
timeout
;
getnatpmprequesttimeout
(
&
handle
,
&
timeout
);
uint64_t
millis
=
(
timeout
.
tv_sec
*
(
uint64_t
)
1000
)
+
(
timeout
.
tv_usec
/
1000
);
// Wait for data.
if
(
poll
(
&
fds
,
1
,
millis
)
==
-
1
)
{
if
(
_
poll
(
&
fds
,
1
,
millis
)
==
-
1
)
{
err
=
NATPMP_ERR_SOCKETERROR
;
break
;
}
...
...
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