summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-08-17 18:41:02 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-08-17 18:41:02 +0200
commit3488af048f336867594330d4abd0ad6dab110ea0 (patch)
treeb3d27974002a01cacf7f6510037a4f7beda9dad6 /src
parented373450a28cff34757a70e2c7a102ecc40e3836 (diff)
Fix the PGM support on win64
On win64 the size of file descriptor is not the same as size of int. The bug in PGM transport caused a runtime error because of this. The problem is fixed now. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src')
-rw-r--r--src/pgm_receiver.cpp4
-rw-r--r--src/pgm_sender.cpp8
-rw-r--r--src/pgm_socket.cpp8
-rw-r--r--src/pgm_socket.hpp7
4 files changed, 14 insertions, 13 deletions
diff --git a/src/pgm_receiver.cpp b/src/pgm_receiver.cpp
index dcd002e..5c1517d 100644
--- a/src/pgm_receiver.cpp
+++ b/src/pgm_receiver.cpp
@@ -60,8 +60,8 @@ int zmq::pgm_receiver_t::init (bool udp_encapsulation_, const char *network_)
void zmq::pgm_receiver_t::plug (io_thread_t *io_thread_, session_t *session_)
{
// Retrieve PGM fds and start polling.
- int socket_fd;
- int waiting_pipe_fd;
+ fd_t socket_fd = retired_fd;
+ fd_t waiting_pipe_fd = retired_fd;
pgm_socket.get_receiver_fds (&socket_fd, &waiting_pipe_fd);
socket_handle = add_fd (socket_fd);
pipe_handle = add_fd (waiting_pipe_fd);
diff --git a/src/pgm_sender.cpp b/src/pgm_sender.cpp
index 79d4e32..e103d9a 100644
--- a/src/pgm_sender.cpp
+++ b/src/pgm_sender.cpp
@@ -65,10 +65,10 @@ int zmq::pgm_sender_t::init (bool udp_encapsulation_, const char *network_)
void zmq::pgm_sender_t::plug (io_thread_t *io_thread_, session_t *session_)
{
// Alocate 2 fds for PGM socket.
- int downlink_socket_fd = 0;
- int uplink_socket_fd = 0;
- int rdata_notify_fd = 0;
- int pending_notify_fd = 0;
+ fd_t downlink_socket_fd = retired_fd;
+ fd_t uplink_socket_fd = retired_fd;
+ fd_t rdata_notify_fd = retired_fd;
+ fd_t pending_notify_fd = retired_fd;
encoder.set_session (session_);
diff --git a/src/pgm_socket.cpp b/src/pgm_socket.cpp
index 98aeeb9..5bf49d0 100644
--- a/src/pgm_socket.cpp
+++ b/src/pgm_socket.cpp
@@ -376,8 +376,8 @@ zmq::pgm_socket_t::~pgm_socket_t ()
// Get receiver fds. receive_fd_ is signaled for incoming packets,
// waiting_pipe_fd_ is signaled for state driven events and data.
-void zmq::pgm_socket_t::get_receiver_fds (int *receive_fd_,
- int *waiting_pipe_fd_)
+void zmq::pgm_socket_t::get_receiver_fds (fd_t *receive_fd_,
+ fd_t *waiting_pipe_fd_)
{
socklen_t socklen;
bool rc;
@@ -403,8 +403,8 @@ void zmq::pgm_socket_t::get_receiver_fds (int *receive_fd_,
// receive_fd_ is for incoming back-channel protocol packets.
// rdata_notify_fd_ is raised for waiting repair transmissions.
// pending_notify_fd_ is for state driven events.
-void zmq::pgm_socket_t::get_sender_fds (int *send_fd_, int *receive_fd_,
- int *rdata_notify_fd_, int *pending_notify_fd_)
+void zmq::pgm_socket_t::get_sender_fds (fd_t *send_fd_, fd_t *receive_fd_,
+ fd_t *rdata_notify_fd_, fd_t *pending_notify_fd_)
{
socklen_t socklen;
bool rc;
diff --git a/src/pgm_socket.hpp b/src/pgm_socket.hpp
index 07acb3d..8b1be54 100644
--- a/src/pgm_socket.hpp
+++ b/src/pgm_socket.hpp
@@ -36,6 +36,7 @@
#include <pgm/in.h>
#endif
+#include "fd.hpp"
#include "options.hpp"
namespace zmq
@@ -56,12 +57,12 @@ namespace zmq
int init (bool udp_encapsulation_, const char *network_);
// Get receiver fds and store them into user allocated memory.
- void get_receiver_fds (int *receive_fd_, int *waiting_pipe_fd_);
+ void get_receiver_fds (fd_t *receive_fd_, fd_t *waiting_pipe_fd_);
// Get sender and receiver fds and store it to user allocated
// memory. Receive fd is used to process NAKs from peers.
- void get_sender_fds (int *send_fd_, int *receive_fd_,
- int *rdata_notify_fd_, int *pending_notify_fd_);
+ void get_sender_fds (fd_t *send_fd_, fd_t *receive_fd_,
+ fd_t *rdata_notify_fd_, fd_t *pending_notify_fd_);
// Send data as one APDU, transmit window owned memory.
size_t send (unsigned char *data_, size_t data_len_);