Commit 245c1844 authored by Matthieu Dorier's avatar Matthieu Dorier

modified bulk tests

parent db0d2e4f
......@@ -32,6 +32,7 @@ int client() {
remote_send.on(server_endpoint)(b);
sleep(1);
remote_stop.on(server_endpoint)();
return 0;
......
......@@ -14,31 +14,31 @@ namespace tl = thallium;
int server() {
tl::engine margo("tcp://127.0.0.1:1234", MARGO_SERVER_MODE);
tl::engine engine("tcp://127.0.0.1:1234", MARGO_SERVER_MODE);
std::function<void(const tl::request&, tl::bulk& b)> f =
[&margo](const tl::request& req, tl::bulk& b) {
[&engine](const tl::request& req, tl::bulk& b) {
auto ep = req.get_endpoint();
std::vector<char> v(6,'*');
std::vector<std::pair<void*,std::size_t>> seg(1);
seg[0].first = (void*)(&v[0]);
seg[0].second = v.size();
tl::bulk local = margo.expose(seg, tl::bulk_mode::write_only);
tl::bulk local = engine.expose(seg, tl::bulk_mode::write_only);
b.on(ep) >> local;
std::cout << "Server received bulk: ";
for(auto c : v) std::cout << c;
std::cout << std::endl;
};
margo.define("send_bulk",f).disable_response();
engine.define("send_bulk",f).disable_response();
std::function<void(const tl::request&)> g =
[&margo](const tl::request& req) {
[&engine](const tl::request& req) {
std::cout << "Stopping server" << std::endl;
margo.finalize();
engine.finalize();
};
margo.define("stop", g);
engine.define("stop", g);
std::string addr = margo.self();
std::string addr = engine.self();
std::cout << "Server running at address " << addr << std::endl;
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment