当前位置: 首页>>代码示例>>C++>>正文


C++ reconnect函数代码示例

本文整理汇总了C++中reconnect函数的典型用法代码示例。如果您正苦于以下问题:C++ reconnect函数的具体用法?C++ reconnect怎么用?C++ reconnect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了reconnect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LS_DBG_L

int ExtConn::connError(int errCode)
{
    LS_DBG_L(this,
             "Connection to [%s] on request #%d, confirmed %d, error: %s!",
             m_pWorker->getURL(), m_iReqProcessed, (int)m_iCPState,
             strerror(errCode));
    if (errCode == EINTR)
        return 0;
    close();
    ExtRequest *pReq = getReq();
    if (pReq)
    {
        if (((m_pWorker->getConnPool().getFreeConns() == 0)
             || ((pReq->getAttempts() % 3) == 0)) &&
            ((errCode == EPIPE) || (errCode == ECONNRESET)) &&
            (pReq->isRecoverable()) && (m_iReqProcessed) && (!m_iCPState))
        {
            pReq->incAttempts();
            pReq->resetConnector();
            if (reconnect() == 0)
                return 0;
            close();
        }
    }
    return m_pWorker->connectionError(this, errCode);
//    if ( !m_pWorker->connectionError( this, errCode ) )
//    {
//        //if (( errCode != ENOMEM )&&(errCode != EMFILE )
//        //        &&( errCode != ENFILE ))
//    }
}
开发者ID:52M,项目名称:openlitespeed,代码行数:31,代码来源:extconn.cpp

示例2: remove_frame

// get next frame
void CameraMJPG::update()
{
	int res = 0;

	// remove previous frame
	remove_frame();

	// get image
	while(!frame){
		if( (res = read_data(buf_read.data, buf_read.real_size))>0 )
			get_image(buf_read.data, res);
		else
			break;
	}

	if (!frame) {
		printf("[!][CameraMJPG][update] Error: cant get frame!\n");
		reconnect(); // переподключение
		return;
	}
	if(show_capture)
	{
		cvShowImage(window_name, frame);
	}
}
开发者ID:Aadi2110,项目名称:openrobovision,代码行数:26,代码来源:camera_mjpg.cpp

示例3: TRACE_ENTER

void WatcherStreamListDialog::newStream()
{
    TRACE_ENTER();
    emit reconnect();
    hide();
    TRACE_EXIT();
}
开发者ID:akbardotinfo,项目名称:watcher-visualization,代码行数:7,代码来源:watcherStreamListDialog.cpp

示例4: on_transport_hup

static void on_transport_hup(struct irc_transport *transport)
{
	struct irc_network *network = transport->userdata;

	network_report_disconnect(network, "Hangup from server, scheduling reconnect");
	reconnect(network);
}
开发者ID:jelmer,项目名称:ctrlproxy,代码行数:7,代码来源:connection.c

示例5: reconnect

void QVidiChat::timerEvent( QTimerEvent * event )
{
    if( reconnectTimerId_ == event->timerId() )
    {
        reconnect();
    }
    else if( statisticTimerId_ == event->timerId() && socket_ && socket_->isValid() && QAbstractSocket::ConnectedState == socket_->state() )
    {
        //socket_->sendTextMessage( "{\"type\":\"get_channel_counters\",\"data\":{\"channel_id\":" + channelId_ +"}}" );
        loadStatistic();
    }
    else if( saveSocketConnectionTimerId_ == event->timerId() && socket_ && socket_->state() == QAbstractSocket::ConnectedState )
    {
        //socket_->sendTextMessage( "[\"{\"type\":\"ping\",\"data\":{}}\"]" );
        socket_->sendTextMessage( "{\"type\":\"get_channel_counters\",\"data\":{\"channel_id\":" + channelId_ +"}}" );
    }
    /*
    else if( saveJoinSocketConnectionTimerId_ == event->timerId() && joinSocket_ && joinSocket_->state() == QAbstractSocket::ConnectedState )
    {
        //joinSocket_->sendTextMessage( "2" );
        joinSocket_->ping( "2" );
    }
    */

}
开发者ID:c0deum,项目名称:BroChat,代码行数:25,代码来源:qvidichat.cpp

示例6: simple_oid_allocator

static void
simple_oid_allocator(void **state)
{
	test_arg_t	*arg = *state;
	uint64_t	oid;
	int		num_oids = 29;
	int		i;
	int		rc;

	for (i = 0; i < 10; i++) {
		MPI_Barrier(MPI_COMM_WORLD);
		if (arg->myrank == 0)
			fprintf(stderr, "%d ---------------------\n", i);
		MPI_Barrier(MPI_COMM_WORLD);

		rc = daos_cont_alloc_oids(arg->coh, num_oids, &oid, NULL);
		if (rc)
			print_message("OID alloc failed (%d)\n", rc);
		assert_int_equal(rc, 0);

		print_message("%d: OID range %" PRId64 " - %" PRId64 "\n",
			      arg->myrank, oid, oid+num_oids);

		reconnect(arg);
	}
}
开发者ID:daos-stack,项目名称:daos,代码行数:26,代码来源:daos_oid_alloc.c

示例7: Assert

/**
 * Initiates a new List Exported Devices request.
 *
 * @returns VBox status code.
 */
int USBProxyBackendUsbIp::startListExportedDevicesReq()
{
    int rc = VINF_SUCCESS;

    /*
     * Reset the current state and reconnect in case we were called in the middle
     * of another transfer (which should not happen).
     */
    Assert(m->enmRecvState == kUsbIpRecvState_None);
    if (m->enmRecvState != kUsbIpRecvState_None)
        rc = reconnect();

    if (RT_SUCCESS(rc))
    {
        /* Send of the request. */
        UsbIpReqDevList ReqDevList;
        ReqDevList.u16Version = RT_H2N_U16(USBIP_VERSION);
        ReqDevList.u16Cmd     = RT_H2N_U16(USBIP_INDICATOR_REQ | USBIP_REQ_RET_DEVLIST);
        ReqDevList.u32Status  = RT_H2N_U32(0);
        rc = RTTcpWrite(m->hSocket, &ReqDevList, sizeof(ReqDevList));
        if (RT_SUCCESS(rc))
            advanceState(kUsbIpRecvState_Hdr);
    }

    return rc;
}
开发者ID:jeppeter,项目名称:vbox,代码行数:31,代码来源:USBProxyBackendUsbIp.cpp

示例8: log_func

void Conn::onRead(const boost::system::error_code& error, std::shared_ptr< boost::asio::streambuf > rd_buf) {
	if( unlikely(error) ) {
		log_func("[iproto_conn] %s:%u read error: %s", ep.address().to_string().c_str(), ep.port(), error.message().c_str() );
		dismissCallbacks(CB_ERR);
		if( error != boost::asio::error::operation_aborted ) {
			reconnect();
		}
		return;
	}
	if( unlikely(!rd_buf) )
		rd_buf.reset(new boost::asio::streambuf);
	if( LOG_DEBUG )
		log_func("[iproto_conn] %s:%u onRead rd_buf->size=%zu", ep.address().to_string().c_str(), ep.port(), rd_buf->size());
	while( rd_buf->size() >= sizeof(Header) ) {
		const PacketPtr *buf = boost::asio::buffer_cast< const PacketPtr * >( rd_buf->data() );
		if( LOG_DEBUG )
			log_func("[iproto_conn] %s:%u onRead buffer iproto packet hdr: len=%u sync=%u msg=%u", ep.address().to_string().c_str(), ep.port(),
				buf->hdr.len, buf->hdr.sync, buf->hdr.msg);
		size_t want_read = sizeof(Header)+buf->hdr.len;
		if( want_read <= rd_buf->size() ) {
			invokeCallback(buf->hdr.sync, RequestResult(CB_OK, Packet(buf)) );
			rd_buf->consume( sizeof(Header) + buf->hdr.len );
		}else{
			size_t rd = want_read - rd_buf->size();
			if( LOG_DEBUG )
				log_func("[iproto_conn] %s:%u onRead want_read=%zu", ep.address().to_string().c_str(), ep.port(), rd);
			boost::asio::async_read(sock, *rd_buf, boost::asio::transfer_at_least(rd),
				boost::bind(&Conn::onRead, shared_from_this(), boost::asio::placeholders::error, rd_buf) );
			return;
		}
	}
	if( likely(sock.is_open()) )
		boost::asio::async_read(sock, *rd_buf, boost::asio::transfer_at_least(sizeof(Header)-rd_buf->size()),
			boost::bind(&Conn::onRead, shared_from_this(), boost::asio::placeholders::error, rd_buf) );
}
开发者ID:PSIAlt,项目名称:asio-libs,代码行数:35,代码来源:iproto_conn.cpp

示例9: loop

void loop(void)
{
  static long lastMsg = 0;
  static int value = 0;
  char msg[50] = { '\0' };

  draw_screen();

  if (!client.connected())
  {
    reconnect();
  }
  client.loop();

  long now = millis();
  if (now - lastMsg > 2000)
  {
    lastMsg = now;

    ++value;
    sprintf(msg, "hello world #%ld", value);
    Serial.print("Publish message: ");
    Serial.println(msg);
    client.publish("outTopic", msg);
  }
}
开发者ID:rpoisel,项目名称:esp8266-arduino-oled-mqtt,代码行数:26,代码来源:main.cpp

示例10: wait_for_input

int wait_for_input(void)
{
   fd_set readfds, writefds, errfds;
   int err;

   int highestfd = 0;

   do {
     FD_ZERO(&readfds);
     FD_ZERO(&writefds);
     FD_ZERO(&errfds);

     FD_SET(g_irccnxn.sock, &readfds);
     FD_SET(g_irccnxn.sock, &writefds);
     FD_SET(g_irccnxn.sock, &errfds);
     highestfd = g_irccnxn.sock;
     
     err = select(highestfd+1, &readfds, NULL, &errfds, NULL);

     if (FD_ISSET(g_irccnxn.sock, &readfds))   /* IRC is calling.. */
         return 1;
#if 0
     if (FD_ISSET(g_irccnxn.sock, &writefds))   /* IRC is calling.. */
        return 1;
#endif
     if (FD_ISSET(g_irccnxn.sock, &errfds)) {  /* some kind of error.. */
         sleep(1);
         reconnect();
     }

     /* handle other network connections here */
   } while (err < 0);

   return 0;  /* ?? */
}
开发者ID:saulpw,项目名称:luabot,代码行数:35,代码来源:net.c

示例11: rconn_connect

/* Drops any existing connection on 'rc', then sets up 'rc' to connect to
 * 'target' and reconnect as needed.  'target' should be a remote OpenFlow
 * target in a form acceptable to vconn_open().
 *
 * If 'name' is nonnull, then it is used in log messages in place of 'target'.
 * It should presumably give more information to a human reader than 'target',
 * but it need not be acceptable to vconn_open(). */
void
rconn_connect(struct rconn *rc, const char *target)
{
    rconn_disconnect(rc);
    rconn_set_target__(rc, target);
    reconnect(rc);
}
开发者ID:ecks,项目名称:harry,代码行数:14,代码来源:rconn.c

示例12: clear_all_result_set

rc_t MYSQLConnection::check_connect(bool_t bKeepAlive, bool_t bFix) {

  if (RC_S_OPEN != m_nStatus) { return RC_S_STATUS; }

  if (TRUE == bFix) {

    clear_all_result_set();
    ASSERT_MYSQL_API;
    int error = MYSQL_CAPI_CALL(ping)(&m_mysql);
    if (0 == error) { return RC_S_OK; }

    // fix
    return reconnect();
  }

  if (TRUE == bKeepAlive) {

    clear_all_result_set();
    ASSERT_MYSQL_API;
    int error = MYSQL_CAPI_CALL(ping)(&m_mysql);
    if (error) { RC_RETURN(RC_S_FAILED + error); }
  }

  return RC_S_OK;
}
开发者ID:obabywawa,项目名称:logsystem,代码行数:25,代码来源:db_mysql.cpp

示例13: qDebug

void StratumClient::processLoginResponce(const QJsonObject& _responceObject, const JsonRpcRequest& _request) {
  if (_responceObject.contains(JSON_RPC_TAG_NAME_ERROR) && !_responceObject.value(JSON_RPC_TAG_NAME_ERROR).isNull()) {
    qDebug() << "Login failed. JsonRPC error. Reconnecting...";
    reconnect();
    return;
  }

  if (_responceObject.value(JSON_RPC_TAG_NAME_RESULT).toObject().value(STRATUM_LOGIN_PARAM_NAME_STATUS).toString() != "OK") {
    qDebug() << "Login failed. Invalid status. Reconnecting...";
    reconnect();
    return;
  }

  m_currentSessionId = _responceObject.value(JSON_RPC_TAG_NAME_RESULT).toObject().value(STRATUM_LOGIN_PARAM_NAME_SESSION_ID).toString();
  updateJob(_responceObject.value(JSON_RPC_TAG_NAME_RESULT).toObject().value(STRATUM_LOGIN_PARAM_NAME_JOB).toObject().toVariantMap());
}
开发者ID:SpaceAdventure,项目名称:bitcediwallet,代码行数:16,代码来源:StratumClient.cpp

示例14: saveCaptions

void NetMonitor::reconnect(HWSession _session)
{
    saveCaptions();
    session=_session;
    title=session.getNameHostPort();
    reconnect(session.getHost(),session.getPort().toInt());
}
开发者ID:Bazzzukasss,项目名称:HWMonitor,代码行数:7,代码来源:NetMonitor.cpp

示例15: host

fluent::Sender::Sender(
                const std::string& h, int p,
                size_t b, float _timeout, bool v)
    :  host(h), port(p), bufmax(b), timeout(_timeout), verbose(v),
        buf(nullptr), sock(Socket::INET, Socket::STREAM)
{
#ifdef FLUENT_MT
    int retval = pthread_mutex_init(&mutex, NULL);
    switch(retval)
    {
        case 0:
            /* success! */
            break;
        case EAGAIN:
            throw NoResources(EAGAIN);
            break;
        case EINVAL:
            throw InvalidAttributes();
            break;
        case ENOMEM:
            throw NoMemory();
            break;
        default:
            throw UnknownError(retval);
    }
#endif
    try {
        reconnect();
    }
    catch(...) {
        close();
    }
}
开发者ID:linxuanwei,项目名称:fluent-logger-cpp,代码行数:33,代码来源:fluent.cpp


注:本文中的reconnect函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。