void messaging_adapter::on_session_remote_open(proton_event &pe) {
    pn_session_t *session = pn_event_session(pe.pn_event());
    class session s(make_wrapper(session));
    delegate_.on_session_open(s);
    if (!is_local_open(pn_session_state(session)) && is_local_unititialised(pn_session_state(session))) {
        pn_session_open(session);
    }
}
void messaging_adapter::on_connection_remote_open(proton_event &pe) {
    pn_connection_t *conn = pn_event_connection(pe.pn_event());
    connection c(make_wrapper(conn));
    transport t(make_wrapper(pn_event_transport(pe.pn_event())));
    delegate_.on_transport_open(t);
    delegate_.on_connection_open(c);
    if (!is_local_open(pn_connection_state(conn)) && is_local_unititialised(pn_connection_state(conn))) {
        pn_connection_open(conn);
    }
}
void messaging_adapter::on_transport_tail_closed(event &e) {
    proton_event *pe = dynamic_cast<proton_event*>(&e);
    if (pe) {
        pn_connection_t *conn = pn_event_connection(pe->pn_event());
        if (conn && is_local_open(pn_connection_state(conn))) {
            messaging_event mevent(messaging_event::DISCONNECT, *pe);
            delegate_.on_disconnect(mevent);
        }
    }
}
void messaging_adapter::on_transport_tail_closed(proton_event &pe) {
    pn_connection_t *conn = pn_event_connection(pe.pn_event());
    if (conn && is_local_open(pn_connection_state(conn))) {
        pn_transport_t *tspt = pn_event_transport(pe.pn_event());
        transport t(make_wrapper(tspt));
        if (pn_condition_is_set(pn_transport_condition(tspt))) {
            delegate_.on_transport_error(t);
        }
        delegate_.on_transport_close(t);
    }
}
void messaging_adapter::on_link_remote_open(event &e) {
    proton_event *pe = dynamic_cast<proton_event*>(&e);
    if (pe) {
        messaging_event mevent(messaging_event::LINK_OPEN, *pe);
        on_link_open(mevent);
        pn_link_t *link = pn_event_link(pe->pn_event());
        if (!is_local_open(pn_link_state(link)) && is_local_unititialised(pn_link_state(link))) {
            pn_link_open(link);
        }
    }
}
void messaging_adapter::on_session_remote_open(event &e) {
    proton_event *pe = dynamic_cast<proton_event*>(&e);
    if (pe) {
        messaging_event mevent(messaging_event::SESSION_OPEN, *pe);
        on_session_open(mevent);
        pn_session_t *session = pn_event_session(pe->pn_event());
        if (!is_local_open(pn_session_state(session)) && is_local_unititialised(pn_session_state(session))) {
            pn_session_open(session);
        }
    }
}
示例#7
0
void messaging_adapter::on_connection_remote_open(event &e) {
    proton_event *pe = dynamic_cast<proton_event*>(&e);
    if (pe) {
        pn_connection_t *connection = pn_event_connection(pe->pn_event());
        if (is_local_open(pn_connection_state(connection))) {
            messaging_event mevent(messaging_event::CONNECTION_OPENED, *pe);
            on_connection_opened(mevent);
        }
        else if (is_local_unititialised(pn_connection_state(connection))) {
            messaging_event mevent(messaging_event::CONNECTION_OPENING, *pe);
            on_connection_opening(mevent);
            pn_connection_open(connection);
        }
    }
}