summaryrefslogtreecommitdiff
path: root/src/pgm_socket.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-05-16 10:44:38 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-05-16 10:44:38 +0200
commitd8d5a627b1835d20270125e27a157c9a7460f0e7 (patch)
treec6c0e9a13b8d38f153b13d5b7aeb1d0c2fe4ed7a /src/pgm_socket.cpp
parent5d0cffc52f575ff572751cc85fd43063391a211d (diff)
Duplicate initialisation of PGM_MULTICAST_HOPS removed
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/pgm_socket.cpp')
-rw-r--r--src/pgm_socket.cpp80
1 files changed, 38 insertions, 42 deletions
diff --git a/src/pgm_socket.cpp b/src/pgm_socket.cpp
index 80b80a7..7011452 100644
--- a/src/pgm_socket.cpp
+++ b/src/pgm_socket.cpp
@@ -169,30 +169,24 @@ int zmq::pgm_socket_t::init (bool udp_encapsulation_, const char *network_)
}
{
- // Propagate various socket options to the OpenPGM layer.
- const int rcvbuf = (int) options.rcvbuf;
- if (rcvbuf) {
- if (!pgm_setsockopt (sock, SOL_SOCKET, SO_RCVBUF, &rcvbuf,
- sizeof (rcvbuf)))
- goto err_abort;
- }
-
- const int sndbuf = (int) options.sndbuf;
- if (sndbuf) {
- if (!pgm_setsockopt (sock, SOL_SOCKET, SO_SNDBUF, &sndbuf,
- sizeof (sndbuf)))
- goto err_abort;
- }
-
- const int max_tpdu = (int) pgm_max_tpdu;
- if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_MTU, &max_tpdu,
- sizeof (max_tpdu)))
- goto err_abort;
-
- const int multicast_hops = (int) options.multicast_hops;
- if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_MULTICAST_HOPS,
- &multicast_hops, sizeof (int)))
- goto err_abort;
+ const int rcvbuf = (int) options.rcvbuf;
+ if (rcvbuf) {
+ if (!pgm_setsockopt (sock, SOL_SOCKET, SO_RCVBUF, &rcvbuf,
+ sizeof (rcvbuf)))
+ goto err_abort;
+ }
+
+ const int sndbuf = (int) options.sndbuf;
+ if (sndbuf) {
+ if (!pgm_setsockopt (sock, SOL_SOCKET, SO_SNDBUF, &sndbuf,
+ sizeof (sndbuf)))
+ goto err_abort;
+ }
+
+ const int max_tpdu = (int) pgm_max_tpdu;
+ if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_MTU, &max_tpdu,
+ sizeof (max_tpdu)))
+ goto err_abort;
}
if (receiver) {
@@ -317,24 +311,26 @@ int zmq::pgm_socket_t::init (bool udp_encapsulation_, const char *network_)
// Set IP level parameters.
{
- const int nonblocking = 1,
- multicast_loop = 0,
- multicast_hops = 16,
-
- // Expedited Forwarding PHB for network elements, no ECN.
- dscp = 0x2e << 2;
-
- if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_MULTICAST_LOOP,
- &multicast_loop, sizeof (multicast_loop)) ||
- !pgm_setsockopt (sock, IPPROTO_PGM, PGM_MULTICAST_HOPS,
- &multicast_hops, sizeof (multicast_hops)))
- goto err_abort;
- if (AF_INET6 != sa_family && !pgm_setsockopt (sock,
- IPPROTO_PGM, PGM_TOS, &dscp, sizeof (dscp)))
- goto err_abort;
- if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_NOBLOCK,
- &nonblocking, sizeof (nonblocking)))
- goto err_abort;
+ const int multicast_loop = 0;
+ if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_MULTICAST_LOOP,
+ &multicast_loop, sizeof (multicast_loop)))
+ goto err_abort;
+
+ const int multicast_hops = options.multicast_hops;
+ if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_MULTICAST_HOPS,
+ &multicast_hops, sizeof (multicast_hops)))
+ goto err_abort;
+
+ // Expedited Forwarding PHB for network elements, no ECN.
+ const int dscp = 0x2e << 2;
+ if (AF_INET6 != sa_family && !pgm_setsockopt (sock,
+ IPPROTO_PGM, PGM_TOS, &dscp, sizeof (dscp)))
+ goto err_abort;
+
+ const int nonblocking = 1;
+ if (!pgm_setsockopt (sock, IPPROTO_PGM, PGM_NOBLOCK,
+ &nonblocking, sizeof (nonblocking)))
+ goto err_abort;
}
// Connect PGM transport to start state machine.