summaryrefslogtreecommitdiff
path: root/src/pgm_socket.cpp
diff options
context:
space:
mode:
authorMartin Lucina <mato@kotelna.sk>2010-02-03 15:54:39 +0100
committerMartin Lucina <mato@kotelna.sk>2010-02-03 15:54:39 +0100
commit72bbc92b70a67fab1dbba6fbd53f574944bdd8e4 (patch)
treeec623cb43ace2debbb703c9ec08c41d13205e146 /src/pgm_socket.cpp
parent6502c16a7fd878e61f0672a47e2cdb4d56ab0eb2 (diff)
parent4172fdd6970d4b42443442bf6633f9a9bd4c6f2b (diff)
Merge branch 'master' of github.com:sustrik/zeromq2
Diffstat (limited to 'src/pgm_socket.cpp')
-rw-r--r--src/pgm_socket.cpp38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/pgm_socket.cpp b/src/pgm_socket.cpp
index 4d713e3..8160ca6 100644
--- a/src/pgm_socket.cpp
+++ b/src/pgm_socket.cpp
@@ -78,33 +78,35 @@ int zmq::pgm_socket_t::init (bool udp_encapsulation_, const char *network_)
nbytes_processed = 0;
pgm_msgv_processed = 0;
+ int rc;
GError *pgm_error = NULL;
- // Init PGM transport.
+ // Init PGM transport if not already done.
// Ensure threading enabled, ensure timer enabled and find PGM protocol id.
//
// Note that if you want to use gettimeofday and sleep for openPGM timing,
// set environment variables PGM_TIMER to "GTOD"
// and PGM_SLEEP to "USLEEP".
- int rc = pgm_init (&pgm_error);
- if (rc != TRUE) {
+ if (!pgm_supported ()) {
+ rc = pgm_init (&pgm_error);
+ if (rc != TRUE) {
+ if (pgm_error->domain == PGM_IF_ERROR && (
+ pgm_error->code == PGM_IF_ERROR_INVAL ||
+ pgm_error->code == PGM_IF_ERROR_XDEV ||
+ pgm_error->code == PGM_IF_ERROR_NODEV ||
+ pgm_error->code == PGM_IF_ERROR_NOTUNIQ ||
+ pgm_error->code == PGM_IF_ERROR_ADDRFAMILY ||
+ pgm_error->code == PGM_IF_ERROR_FAMILY ||
+ pgm_error->code == PGM_IF_ERROR_NODATA ||
+ pgm_error->code == PGM_IF_ERROR_NONAME ||
+ pgm_error->code == PGM_IF_ERROR_SERVICE)) {
+ errno = EINVAL;
+ g_error_free (pgm_error);
+ return -1;
+ }
- if (pgm_error->domain == PGM_IF_ERROR && (
- pgm_error->code == PGM_IF_ERROR_INVAL ||
- pgm_error->code == PGM_IF_ERROR_XDEV ||
- pgm_error->code == PGM_IF_ERROR_NODEV ||
- pgm_error->code == PGM_IF_ERROR_NOTUNIQ ||
- pgm_error->code == PGM_IF_ERROR_ADDRFAMILY ||
- pgm_error->code == PGM_IF_ERROR_FAMILY ||
- pgm_error->code == PGM_IF_ERROR_NODATA ||
- pgm_error->code == PGM_IF_ERROR_NONAME ||
- pgm_error->code == PGM_IF_ERROR_SERVICE)) {
- errno = EINVAL;
- g_error_free (pgm_error);
- return -1;
+ zmq_assert (false);
}
-
- zmq_assert (false);
}
// PGM transport GSI.