• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ reconnect函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: smscenter_receive_msg

static Msg *sms_receive(SMSCConn *conn)
{
    SmscWrapper *wrap = conn->data;
    int ret;
    Msg *newmsg = NULL;

    if (smscenter_pending_smsmessage(wrap->smsc) == 1) {

        ret = smscenter_receive_msg(wrap->smsc, &newmsg);
        if (ret == 1) {

            /* if any smsc_id available, use it */
            newmsg->sms.smsc_id = octstr_duplicate(conn->id);

	    return newmsg;
        } else if (ret == 0) { /* "NEVER" happens */
            warning(0, "SMSC %s: Pending message returned '1', "
                    "but nothing to receive!", octstr_get_cstr(conn->name));
            msg_destroy(newmsg);
            return NULL;
        } else {
            msg_destroy(newmsg);
	    if (reconnect(conn) == -1)
		smscconn_shutdown(conn, 0);
	    return NULL;
        }
    }
    return NULL;
}
开发者ID:Jayriq,项目名称:kannel-gateway,代码行数:29,代码来源:smsc_wrapper.c


示例17: lock

void tcp_client::run_no_wait()
{
	tcp_session::run();
	{
		boost::mutex::scoped_lock lock( m_mutex );
		if( !m_isconnected && m_isreconnect && !m_isconnecting && m_isinitconncted )
		{
			unsigned int now = (unsigned int)time( NULL );
			if( now - m_last_reconnect_time > m_reconnect_time )
				reconnect();
		}
	}

	m_cb_mgr.poll();
	int proc_index = 0;
	{
		boost::mutex::scoped_lock lock( m_msg_mutex );
		if( m_queue_recv_msg[m_current_recv_queue].empty() )
			return;
		
		proc_index = m_current_recv_queue;
		m_current_recv_queue = !m_current_recv_queue;
	}
	while( !m_queue_recv_msg[proc_index].empty() )
	{
		message_t* msg = m_queue_recv_msg[proc_index].front();
		proc_message( *msg );
		net_global::free_message( msg );
		m_queue_recv_msg[proc_index].pop();
	}
}
开发者ID:kingstop,项目名称:830,代码行数:31,代码来源:tcpclient.cpp


示例18: getKeepAlive

std::ostream& HTTPClientSession::sendRequest(HTTPRequest& request)
{
	delete _pResponseStream;
	_pResponseStream = 0;

	bool keepAlive = getKeepAlive();
	if ((connected() && !keepAlive) || mustReconnect())
	{
		close();
		_mustReconnect = false;
	}
	try
	{
		if (!connected())
			reconnect();
		if (!keepAlive)
			request.setKeepAlive(false);
		if (!request.has(HTTPRequest::HOST))
			request.setHost(_host, _port);
		if (!_proxyHost.empty())
		{
			request.setURI(proxyRequestPrefix() + request.getURI());
			proxyAuthenticate(request);
		}
		_reconnect = keepAlive;
		_expectResponseBody = request.getMethod() != HTTPRequest::HTTP_HEAD;
		if (request.getChunkedTransferEncoding())
		{
			HTTPHeaderOutputStream hos(*this);
			request.write(hos);
			_pRequestStream = new HTTPChunkedOutputStream(*this);
		}
		else if (request.getContentLength() != HTTPMessage::UNKNOWN_CONTENT_LENGTH)
		{
			Poco::CountingOutputStream cs;
			request.write(cs);
			_pRequestStream = new HTTPFixedLengthOutputStream(*this, request.getContentLength() + cs.chars());
			request.write(*_pRequestStream);
		}
		else if (request.getMethod() != HTTPRequest::HTTP_PUT && request.getMethod() != HTTPRequest::HTTP_POST)
		{
			Poco::CountingOutputStream cs;
			request.write(cs);
			_pRequestStream = new HTTPFixedLengthOutputStream(*this, cs.chars());
			request.write(*_pRequestStream);
		}
		else
		{
			_pRequestStream = new HTTPOutputStream(*this);
			request.write(*_pRequestStream);
		}	
		_lastRequest.update();
		return *_pRequestStream;
	}
	catch (Exception&)
	{
		close();
		throw;
	}
}
开发者ID:BrianHoldsworth,项目名称:Poco,代码行数:60,代码来源:HTTPClientSession.cpp


示例19: reconnect

void MqttBridge::reconnect(){
    if (!client->isConnected()){
      client->connect();
      QTimer::singleShot(2000,this,SLOT(reconnect()));
    }

}
开发者ID:tipih,项目名称:mqtttodbudbridge,代码行数:7,代码来源:mqttbridge.cpp


示例20: reconnect

void tcp_client::_connect( std::string address, unsigned short port )
{
	m_endpoint.port( port );
	m_endpoint.address( boost::asio::ip::address_v4::from_string( address ) );
	reconnect();
	m_isinitconncted = true;
}
开发者ID:kingstop,项目名称:830,代码行数:7,代码来源:tcpclient.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ reconstruct函数代码示例发布时间:2022-05-30
下一篇:
C++ reconfigure函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap