void on_delivery_accept(proton::event &e) {
     confirmed++;
     if (confirmed == total) {
         std::cout << "all messages confirmed" << std::endl;
         e.connection().close();
         acceptor.close();
     }
 }
 void on_connection_open(proton::event &e, proton::connection &c) override {
     std::cout << "Inbound server connection connected via SSL.  Protocol: " <<
         c.transport().ssl().protocol() << std::endl;
     if (c.transport().sasl().outcome() == sasl::OK) {
         std::string subject = c.transport().ssl().remote_subject();
         std::cout << "Inbound client certificate identity " << find_CN(subject) << std::endl;
     }
     else {
         std::cout << "Inbound client authentication failed" <<std::endl;
         c.close();
     }
     inbound_listener.close();
 }
 void on_message(proton::event &e) {
     proton::message& msg = e.message();
     if (msg.id().get<uint64_t>() < received)
         return; // ignore duplicate
     if (expected == 0 || received < expected) {
         std::cout << msg.body() << std::endl;
         received++;
     }
     if (received == expected) {
         e.receiver().close();
         e.connection().close();
         if (!!acceptor) acceptor.close();
     }
 }
Exemple #4
0
    void on_message(proton::delivery &d, proton::message &msg) override {
        if (proton::coerce<uint64_t>(msg.id()) < received) {
            return; // Ignore duplicate
        }

        if (expected == 0 || received < expected) {
            std::cout << msg.body() << std::endl;
            received++;
        }

        if (received == expected) {
            d.receiver().close();
            d.connection().close();

            if (!!acceptor) acceptor.close();
        }
    }
Exemple #5
0
 void on_connection_open(proton::connection &c) override {
     std::cout << "Inbound server connection connected via SSL.  Protocol: " <<
         c.transport().ssl().protocol() << std::endl;
     acceptor.close();
 }