summaryrefslogtreecommitdiff
path: root/src/session_base.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2012-04-15 13:10:41 +0200
committerMartin Sustrik <sustrik@250bpm.com>2012-04-17 07:30:52 +0200
commit443d06f894751062da6d69238ce09f6fbfc27577 (patch)
tree44d21141df628f1cba965b7466267faa51f9d34c /src/session_base.cpp
parent692688206d5061de2a2b6a3d3040318dc537f221 (diff)
"Survey" pattern implemented
Survey pattern is "multicast with reply". There are two roles: surveyor and respondent. Surveyor publishes a survey which gets delivered to all connected respondents. Each repondent can send a response to the survey. All the responses are delivered to the original surveyor. Once the surveyor decides that the survey is over (e.g. deadline was reached) it can send initiate survey. Late responses from old surveys are automatically discarded by the surveyor socket. Socket types: SURVEYOR, XSURVEYOR, RESPONDENT, XRESPONDENT Patch also includes a test program with surveoyr, two respondents and an intermediary device. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/session_base.cpp')
-rw-r--r--src/session_base.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/session_base.cpp b/src/session_base.cpp
index 90fa071..35c4a4e 100644
--- a/src/session_base.cpp
+++ b/src/session_base.cpp
@@ -42,6 +42,10 @@
#include "push.hpp"
#include "pull.hpp"
#include "pair.hpp"
+#include "surveyor.hpp"
+#include "xsurveyor.hpp"
+#include "respondent.hpp"
+#include "xrespondent.hpp"
xs::session_base_t *xs::session_base_t::create (class io_thread_t *io_thread_,
bool connect_, class socket_base_t *socket_, const options_t &options_,
@@ -93,6 +97,22 @@ xs::session_base_t *xs::session_base_t::create (class io_thread_t *io_thread_,
s = new (std::nothrow) pair_session_t (io_thread_, connect_,
socket_, options_, protocol_, address_);
break;
+ case XS_SURVEYOR:
+ s = new (std::nothrow) surveyor_session_t (io_thread_, connect_,
+ socket_, options_, protocol_, address_);
+ break;
+ case XS_XSURVEYOR:
+ s = new (std::nothrow) xsurveyor_session_t (io_thread_, connect_,
+ socket_, options_, protocol_, address_);
+ break;
+ case XS_RESPONDENT:
+ s = new (std::nothrow) respondent_session_t (io_thread_, connect_,
+ socket_, options_, protocol_, address_);
+ break;
+ case XS_XRESPONDENT:
+ s = new (std::nothrow) xrespondent_session_t (io_thread_, connect_,
+ socket_, options_, protocol_, address_);
+ break;
default:
errno = EINVAL;
return NULL;