Skip to content

Commit

Permalink
move poll wrapper on top of select (only used on Windows) to the ix n…
Browse files Browse the repository at this point in the history
…amespace
  • Loading branch information
Benjamin Sergeant committed Sep 8, 2019
1 parent 260a94d commit 6a3ffcb
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DOCKER_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.0
6.1.0
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

## [6.1.0] - 2019-09-08

- move poll wrapper on top of select (only used on Windows) to the ix namespace

## [6.0.1] - 2019-09-05

- add cobra metrics publisher + server unittest
Expand Down
10 changes: 6 additions & 4 deletions ixwebsocket/IXNetSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ namespace ix
return true;
#endif
}
}

// This function should be in the global namespace
#ifdef _WIN32
//
// That function could 'return WSAPoll(pfd, nfds, timeout);'
// but WSAPoll is said to have weird behaviors on the internet
Expand All @@ -47,6 +44,7 @@ namespace ix
//
int poll(struct pollfd *fds, nfds_t nfds, int timeout)
{
#ifdef _WIN32
int maxfd = 0;
fd_set readfds, writefds, errorfds;
FD_ZERO(&readfds);
Expand Down Expand Up @@ -107,5 +105,9 @@ namespace ix
}

return ret;
}
#else
return ::poll(fds, nfds, timeout);
#endif
}

} // namespace ix
6 changes: 3 additions & 3 deletions ixwebsocket/IXNetSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
#include <io.h>
#include <ws2def.h>

// Define our own poll on Windows
// Define our own poll on Windows, as a wrapper on top of select
typedef unsigned long int nfds_t;

int poll(struct pollfd* fds, nfds_t nfds, int timeout);

#else
#include <arpa/inet.h>
#include <errno.h>
Expand All @@ -35,4 +33,6 @@ namespace ix
{
bool initNetSystem();
bool uninitNetSystem();

int poll(struct pollfd* fds, nfds_t nfds, int timeout);
} // namespace ix
2 changes: 1 addition & 1 deletion ixwebsocket/IXSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace ix
}
}

int ret = ::poll(fds, nfds, timeoutMs);
int ret = ix::poll(fds, nfds, timeoutMs);

PollResultType pollResult = PollResultType::ReadyForRead;
if (ret < 0)
Expand Down
2 changes: 1 addition & 1 deletion ixwebsocket/IXWebSocketVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

#pragma once

#define IX_WEBSOCKET_VERSION "6.0.0"
#define IX_WEBSOCKET_VERSION "6.1.0"

0 comments on commit 6a3ffcb

Please sign in to comment.