Пример #1
0
void xs::stream_engine_t::error ()
{
    xs_assert (session);
    session->detach ();
    unplug ();
    delete this;
}
Пример #2
0
static int test_request(void)
{
	uint32_t expected_rdo = RDO_FIXED(1, 900, 900, RDO_CAP_MISMATCH);

	plug_in_source(0, 0);
	task_wake(PD_PORT_TO_TASK_ID(0));
	task_wait_event(2 * PD_T_CC_DEBOUNCE + 100 * MSEC);
	TEST_ASSERT(pd_port[0].polarity == 0);

	/* We're in SNK_DISCOVERY now. Let's send the source cap. */
	simulate_source_cap(0);
	task_wait_event(30 * MSEC);
	TEST_ASSERT(verify_goodcrc(0, PD_ROLE_SINK, pd_port[0].msg_rx_id));

	/* Wait for the power request */
	task_wake(PD_PORT_TO_TASK_ID(0));
	task_wait_event(35 * MSEC); /* tSenderResponse: 24~30 ms */
	inc_rx_id(0);

	/* Process the request */
	TEST_ASSERT(pd_test_tx_msg_verify_sop(0));
	TEST_ASSERT(pd_test_tx_msg_verify_short(0,
			PD_HEADER(PD_DATA_REQUEST, PD_ROLE_SINK, PD_ROLE_UFP,
				  pd_port[0].msg_tx_id, 1)));
	TEST_ASSERT(pd_test_tx_msg_verify_word(0, expected_rdo));
	TEST_ASSERT(pd_test_tx_msg_verify_crc(0));
	TEST_ASSERT(pd_test_tx_msg_verify_eop(0));
	inc_tx_id(0);

	/* We're done */
	unplug(0);
	return EC_SUCCESS;
}
Пример #3
0
void zmq::stream_engine_t::error (error_reason_t reason_)
{
    if (_options.raw_socket && _options.raw_notify) {
        //  For raw sockets, send a final 0-length message to the application
        //  so that it knows the peer has been disconnected.
        msg_t terminator;
        terminator.init ();
        (this->*_process_msg) (&terminator);
        terminator.close ();
    }
    zmq_assert (_session);
#ifdef ZMQ_BUILD_DRAFT_API
    // protocol errors have been signaled already at the point where they occurred
    if (reason_ != protocol_error
        && (_mechanism == NULL
            || _mechanism->status () == mechanism_t::handshaking)) {
        int err = errno;
        _socket->event_handshake_failed_no_detail (_endpoint, err);
    }
#endif
    _socket->event_disconnected (_endpoint, _s);
    _session->flush ();
    _session->engine_error (reason_);
    unplug ();
    delete this;
}
Пример #4
0
void zmq::zmq_engine_t::error ()
{
    zmq_assert (inout);
    inout->detach ();
    unplug ();
    delete this;
}
Пример #5
0
void KPlayerTrackActionList::update (const QMap<int, QString>& ids, int id)
{
  unplug();
  if ( ids.count() > 1 )
    addActions (ids, id);
  plug();
}
Пример #6
0
static int test_sink(void)
{
	int i;

	plug_in_sink(1, 1);
	task_wake(PD_PORT_TO_TASK_ID(1));
	task_wait_event(250 * MSEC); /* tTypeCSinkWaitCap: 210~250 ms */
	TEST_ASSERT(pd_port[1].polarity == 1);

	/* The source cap should be sent */
	TEST_ASSERT(pd_test_tx_msg_verify_sop(1));
	TEST_ASSERT(pd_test_tx_msg_verify_short(1,
			PD_HEADER(PD_DATA_SOURCE_CAP, PD_ROLE_SOURCE,
				  PD_ROLE_DFP, pd_port[1].msg_tx_id,
				  pd_src_pdo_cnt)));
	for (i = 0; i < pd_src_pdo_cnt; ++i)
		TEST_ASSERT(pd_test_tx_msg_verify_word(1, pd_src_pdo[i]));
	TEST_ASSERT(pd_test_tx_msg_verify_crc(1));
	TEST_ASSERT(pd_test_tx_msg_verify_eop(1));

	/* Looks good. Ack the source cap. */
	simulate_goodcrc(1, PD_ROLE_SINK, pd_port[1].msg_tx_id);
	task_wake(PD_PORT_TO_TASK_ID(1));
	usleep(30 * MSEC);
	inc_tx_id(1);

	/* We're done */
	unplug(1);
	return EC_SUCCESS;
}
Пример #7
0
void zmq::stream_engine_t::error (error_reason_t reason)
{
    if (options.raw_socket && options.raw_notify) {
        //  For raw sockets, send a final 0-length message to the application
        //  so that it knows the peer has been disconnected.
        msg_t terminator;
        terminator.init();
        (this->*process_msg) (&terminator);
        terminator.close();
    }
    zmq_assert (session);
#ifdef ZMQ_BUILD_DRAFT_API
    int err = errno;
    if (mechanism == NULL) {
        if (reason == protocol_error)
            socket->event_handshake_failed_zmtp (endpoint, err);
        else
            socket->event_handshake_failed_no_detail (endpoint, err);
    } else if (mechanism->status () == mechanism_t::handshaking) {
        if (mechanism->error_detail () == mechanism_t::zmtp)
            socket->event_handshake_failed_zmtp (endpoint, err);
        else if (mechanism->error_detail () == mechanism_t::zap)
            socket->event_handshake_failed_zap (endpoint, err);
        else if (mechanism->error_detail () == mechanism_t::encryption)
            socket->event_handshake_failed_encryption (endpoint, err);
        else
            socket->event_handshake_failed_no_detail (endpoint, err);
    }
#endif
    socket->event_disconnected (endpoint, (int) s);
    session->flush ();
    session->engine_error (reason);
    unplug ();
    delete this;
}
Пример #8
0
void zmq::stream_engine_t::error ()
{
    zmq_assert (session);
    socket->event_disconnected (endpoint.c_str(), s);
    session->detach ();
    unplug ();
    delete this;
}
Пример #9
0
void zmq::stream_engine_t::error ()
{
    zmq_assert (session);
    session->monitor_event (ZMQ_EVENT_DISCONNECTED, endpoint.c_str(), s);
    session->detach ();
    unplug ();
    delete this;
}
Пример #10
0
void ClientSktTcp::error()
{
    QTcpSocket* s = qobject_cast<QTcpSocket*>(sender());

    show(QString("TCP socket error %1, %2").arg(s->error()).arg(s->errorString()));

    unplug();
}
Пример #11
0
void zmq::stream_engine_t::terminate ()
{
    if (!terminating && encoder && encoder->has_data ()) {
        //  Give io_thread a chance to send in the buffer
        terminating = true;
        return;
    }
    unplug ();
    delete this;
}
Пример #12
0
void zmq::stream_engine_t::error (error_reason_t reason)
{
    if (options.raw_socket) {
        //  For raw sockets, send a final 0-length message to the application
        //  so that it knows the peer has been disconnected.
        msg_t terminator;
        terminator.init();
        (this->*process_msg) (&terminator);
        terminator.close();
    }
    zmq_assert (session);
    socket->event_disconnected (endpoint, (int) s);
    session->flush ();
    session->engine_error (reason);
    unplug ();
    delete this;
}
Пример #13
0
void KPlayerSimpleActionList::update (void)
{
#ifdef DEBUG_KPLAYER_ACTIONLIST
  kdDebugTime() << "KPlayerSimpleActionList::update\n";
#endif
  unplug();
  QStringList::ConstIterator iterator (m_names.constBegin());
  while ( iterator != m_names.constEnd() )
  {
    QAction* action = new KAction (this);
    connect (action, SIGNAL (triggered()), SLOT (actionActivated()));
    action -> setText (*iterator);
    updateAction (action);
    m_actions.append (action);
    ++ iterator;
  }
  plug();
}
Пример #14
0
void zmq::zmq_engine_t::error ()
{
    zmq_assert (inout);

    zmq_connecter_t *reconnecter = NULL;
    if (reconnect) {

        //  Create a connecter object to attempt reconnect.
        //  Ask it to wait for a while before reconnecting.
        reconnecter = new (std::nothrow) zmq_connecter_t (
            inout->get_io_thread (), inout->get_owner (),
            options, inout->get_ordinal (), true);
        zmq_assert (reconnecter);
        reconnecter->set_address (address.c_str ());
    }

    inout->detach (reconnecter);
    unplug ();
    delete this;
}
Пример #15
0
void KPlayerSubtitleTrackActionList::update (bool show, const QMap<int, QString>& sids, int sid,
  const QMap<int, QString>& vsids, int vsid, QStringList files, const QString& vobsub, const QString& current)
{
  unplug();
  if ( sids.count() > 0 || vsids.count() > 0 || files.count() > 0 )
  {
    KToggleAction* action = new KToggleAction (m_action_group);
    connect (action, SIGNAL (triggered()), SLOT (actionActivated()));
    action -> setText (i18n("&None"));
    action -> setStatusTip (i18n("Turns off subtitle display"));
    action -> setWhatsThis (i18n("The 'Subtitles -- None' command turns off subtitle display."));
    if ( ! show )
      action -> setChecked (true);
    m_actions.append (action);
    addActions (sids, sid);
    addActions (vsids, vsid);
    if ( vsids.isEmpty() )
      files << vobsub;
    QStringList::ConstIterator iterator (files.constBegin()), end (files.constEnd());
    while ( iterator != end )
    {
      QString text ((*iterator).section ('/', -1, -1));
#ifdef DEBUG_KPLAYER_ACTIONLIST
      kdDebugTime() << " Subtitle file '" << text << "' " << *iterator << "\n";
#endif
      if ( ! text.isEmpty() )
      {
        action = new KToggleAction (m_action_group);
        connect (action, SIGNAL (triggered()), SLOT (actionActivated()));
        action -> setText (text);
        updateAction (action);
        action -> setText (text);
        if ( show && sid < 0 && vsid < 0 && *iterator == current )
          action -> setChecked (true);
        m_actions.append (action);
      }
      ++ iterator;
    }
  }
  plug();
}
Пример #16
0
void zmq::stream_engine_t::terminate ()
{
    unplug ();
    delete this;
}
Пример #17
0
void zmq::pgm_sender_t::terminate ()
{
    unplug ();
    delete this;
}
Пример #18
0
void zmq::pgm_receiver_t::terminate ()
{
    unplug ();
    delete this;
}
Пример #19
0
void zmq::norm_engine_t::terminate()
{
    unplug();
    shutdown();
    delete this;
}