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

C++ setClient函数代码示例

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

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



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

示例1: runDaemon

int
runDaemon(int debug)
{
  char			packetPtr[PACKETLEN];
  size_t	       	packetSize;
  struct sockaddr_in	sa;

  if (checkOtherProcess())
    return (EXIT_FAILURE);
  signal(SIGTERM, sigHandler);
  signal(SIGINT, sigHandler);
  signal(SIGUSR1, sigHandler);

  if (!debug) {
    daemon(1, 1);
    if (savePid())
      return EXIT_FAILURE;
  }

  fprintf(stderr, "Daemon started\n");

  initConnection(&sa);
  while (1) {
    setClient(acceptClient(&sa));
    bzero(packetPtr, PACKETLEN);
    getPacket(packetPtr, &packetSize);
    handlePacket(packetPtr, packetSize);
    setClient(-1);
  }
  setSock(-1);
  return EXIT_SUCCESS;
}
开发者ID:Frozenhorns,项目名称:project,代码行数:32,代码来源:daemon.c


示例2: setServer

MqttClient::MqttClient(uint8_t *ip, uint16_t port, MQTT_CALLBACK_SIGNATURE, Nokia_MqttClientAdapter& client, Stream& stream) {
    this->_state = MQTT_DISCONNECTED;
    setServer(ip,port);
    setCallback(callback);
    setClient(client);
    setStream(stream);
}
开发者ID:lsuciu70,项目名称:arduino,代码行数:7,代码来源:MqttClient.cpp


示例3: receivedUpdate

    void receivedUpdate(Message& m, stringstream& ss) {
        DbMessage d(m);
        const char *ns = d.getns();
        assert(*ns);
        uassert( "not master", isMasterNs( ns ) );
        setClient(ns);
        Client& client = cc();
        client.top.setWrite();
        ss << ns << ' ';
        int flags = d.pullInt();
        BSONObj query = d.nextJsObj();

        assert( d.moreJSObjs() );
        assert( query.objsize() < m.data->dataLen() );
        BSONObj toupdate = d.nextJsObj();
        uassert("update object too large", toupdate.objsize() <= MaxBSONObjectSize);
        assert( toupdate.objsize() < m.data->dataLen() );
        assert( query.objsize() + toupdate.objsize() < m.data->dataLen() );
        bool upsert = flags & Option_Upsert;
        bool multi = flags & Option_Multi;
        {
            string s = query.toString();
            /* todo: we shouldn't do all this ss stuff when we don't need it, it will slow us down. */
            ss << " query: " << s;
            CurOp& currentOp = *client.curop();
            strncpy(currentOp.query, s.c_str(), sizeof(currentOp.query)-2);
        }        
        UpdateResult res = updateObjects(ns, toupdate, query, upsert, multi, ss, true);
        recordUpdate( res.existing , res.num ); // for getlasterror
    }
开发者ID:fizx,项目名称:mongo,代码行数:30,代码来源:instance.cpp


示例4: run

 virtual bool run(const char *ns, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
     string fromhost = cmdObj.getStringField("from");
     if ( fromhost.empty() ) {
         errmsg = "missing from spec";
         return false;
     }
     string collection = cmdObj.getStringField("cloneCollection");
     if ( collection.empty() ) {
         errmsg = "missing cloneCollection spec";
         return false;
     }
     BSONObj query = cmdObj.getObjectField("query");
     if ( query.isEmpty() )
         query = BSONObj();
     BSONElement copyIndexesSpec = cmdObj.getField("copyindexes");
     bool copyIndexes = copyIndexesSpec.isBoolean() ? copyIndexesSpec.boolean() : true;
     // Will not be used if doesn't exist.
     int logSizeMb = cmdObj.getIntField( "logSizeMb" );
     
     /* replication note: we must logOp() not the command, but the cloned data -- if the slave
      were to clone it would get a different point-in-time and not match.
      */
     setClient( collection.c_str() );
     
     log() << "cloneCollection.  db:" << ns << " collection:" << collection << " from: " << fromhost << " query: " << query << " logSizeMb: " << logSizeMb << ( copyIndexes ? "" : ", not copying indexes" ) << endl;
     
     Cloner c;
     long long cursorId;
     if ( !c.startCloneCollection( fromhost.c_str(), collection.c_str(), query, errmsg, !fromRepl, copyIndexes, logSizeMb, cursorId ) )
         return false;
     return c.finishCloneCollection( fromhost.c_str(), collection.c_str(), query, cursorId, errmsg);
 }
开发者ID:gregglind,项目名称:mongo,代码行数:32,代码来源:cloner.cpp


示例5: setServer

PubSubClient::PubSubClient(uint8_t *ip, uint16_t port, MQTT_CALLBACK_SIGNATURE, Client& client) {
    this->_state = MQTT_DISCONNECTED;
    setServer(ip, port);
    setCallback(callback);
    setClient(client);
    this->stream = NULL;
}
开发者ID:OttoWinter,项目名称:pubsubclient,代码行数:7,代码来源:PubSubClient.cpp


示例6: setServer

PubSubClient::PubSubClient(const char* domain, uint16_t port, Client& client, Stream& stream) {
    this->_state = MQTT_DISCONNECTED;
    setServer(domain,port);
    setClient(client);
    setStream(stream);
    setProtocol(MQTT_VERSION);
}
开发者ID:mirkoflchtt,项目名称:pubsubclient,代码行数:7,代码来源:PubSubClient.cpp


示例7: run

 void run() {
     dblock lk;
     const char *ns = "unittests.cursortests.BtreeCursorTests.MultiRangeGap";
     {
         DBDirectClient c;
         for( int i = 0; i < 10; ++i )
             c.insert( ns, BSON( "a" << i ) );
         for( int i = 100; i < 110; ++i )
             c.insert( ns, BSON( "a" << i ) );
         ASSERT( c.ensureIndex( ns, BSON( "a" << 1 ) ) );
     }
     BoundList b;
     b.push_back( pair< BSONObj, BSONObj >( BSON( "" << -50 ), BSON( "" << 2 ) ) );
     b.push_back( pair< BSONObj, BSONObj >( BSON( "" << 40 ), BSON( "" << 60 ) ) );
     b.push_back( pair< BSONObj, BSONObj >( BSON( "" << 109 ), BSON( "" << 200 ) ) );
     setClient( ns );
     BtreeCursor c( nsdetails( ns ), 1, nsdetails( ns )->indexes[ 1 ], b, 1 );
     ASSERT_EQUALS( "BtreeCursor a_1 multi", c.toString() );
     double expected[] = { 0, 1, 2, 109 };
     for( int i = 0; i < 4; ++i ) {
         ASSERT( c.ok() );
         ASSERT_EQUALS( expected[ i ], c.currKey().firstElement().number() );
         c.advance();
     }
     ASSERT( !c.ok() );
 }
开发者ID:hashrocket,项目名称:mongo,代码行数:26,代码来源:cursortests.cpp


示例8: bl

    bool Client::shutdown(){
        _shutdown = true;

        {
            boostlock bl(clientsMutex);
            clients.erase(this);
        }

        bool didAnything = false;
        
        if ( _tempCollections.size() ){
            didAnything = true;
            for ( list<string>::iterator i = _tempCollections.begin(); i!=_tempCollections.end(); i++ ){
                string ns = *i;
                dblock l;
                setClient( ns.c_str() );
                if ( ! nsdetails( ns.c_str() ) )
                    continue;
                try {
                    string err;
                    BSONObjBuilder b;
                    dropCollection( ns , err , b );
                }
                catch ( ... ){
                    log() << "error dropping temp collection: " << ns << endl;
                }
            }
            _tempCollections.clear();
        }
        
        return didAnything;
    }
开发者ID:gregglind,项目名称:mongo,代码行数:32,代码来源:client.cpp


示例9: ASSERT

void ResourceHandle::receivedCredential(const AuthenticationChallenge& challenge, const Credential& credential)
{
    ASSERT(!challenge.isNull());
    if (challenge != d->m_currentWebChallenge)
        return;

    if (credential.isEmpty()) {
        receivedRequestToContinueWithoutCredential(challenge);
        return;
    }

    KURL urlToStore;
    urlToStore = d->m_request.url();

    CredentialStorage::set(credential, challenge.protectionSpace(), urlToStore);

    clearAuthentication();
    // Clone our ResourceHandle and add it so that it is send with the credential.
    // FIXME: We should have a way of cloning an handle.
    RefPtr<ResourceHandle> newHandle = ResourceHandle::create(request(), client(), 0, d->m_defersLoading, shouldContentSniff());
    setClient(0); // Clear the client to avoid it being cleared by WebCore.
    AuthenticationChallenge newAuthenticationChallenge(challenge.protectionSpace(), credential, challenge.previousFailureCount() + 1, challenge.failureResponse(), challenge.error());

    // Store the new authentication challenge.
    newHandle->getInternal()->m_currentWebChallenge = newAuthenticationChallenge;
    d->m_cancelled = true;
}
开发者ID:ezrec,项目名称:owb-mirror,代码行数:27,代码来源:BCResourceHandleCurl.cpp


示例10: setIsCompiling

void HostItem::update(const Job &job)
{
    setIsCompiling(job.state() == Job::Compiling);
    setClient(job.client());

    if (job.state() == Job::WaitingForCS)
        return;

    bool finished = job.state() == Job::Finished ||
                    job.state() == Job::Failed;

    JobList::Iterator it = m_jobs.find(job.jobId());
    bool newJob = (it == m_jobs.end());

    if (newJob && finished)
        return;
    if (!newJob && !finished)
        return;

    if (newJob) {
        m_jobs.insert(job.jobId(), job);
        createJobHalo(job);
    } else if (finished) {
        deleteJobHalo(job);
        m_jobs.erase(it);
    }
}
开发者ID:lizardo,项目名称:Iceberg,代码行数:27,代码来源:starview.cpp


示例11: setServer

PubSubClient::PubSubClient(const char* domain, uint16_t port, Client& client, Stream& stream) {
    this->_state = MQTT_DISCONNECTED;
    setServer(domain,port);
    setClient(client);
    setStream(stream);
    setListener(NULL);  // TOAST
}
开发者ID:toastedcode,项目名称:pubsubclient,代码行数:7,代码来源:PubSubClient.cpp


示例12: IFrameWindow

/*------------------------------------------------------------------------------
| MyFrame::MyFrame                                                             |
------------------------------------------------------------------------------*/
MyFrame::MyFrame( )
  : IFrameWindow( "Manipulating Dialogues in C++",
                  ID_MYFRAME,
                  IFrameWindow::defaultStyle() | IFrameWindow::shellPosition ),
    clientCanvas( FID_CLIENT, this, this ),
    createButton ( ID_CREATEBUTTON, &clientCanvas, &clientCanvas ),
    quitButton ( DID_CANCEL, &clientCanvas, &clientCanvas ),
    pSampleDlg( 0 ),
    commandHandler( *this )

{
  createButton
    .setText( "Create Dialogue" )
    .enableTabStop();

  quitButton
    .setText( "Quit" )
    .enableTabStop();

  commandHandler.handleEventsFor( this );

  setClient( &clientCanvas );
  sizeTo( ISize( 100, 100) + clientCanvas.minimumSize( ) );
  show();
  setFocus();
}
开发者ID:OS2World,项目名称:DEV-SAMPLES-CPLUSPLUS-dlgcpp,代码行数:29,代码来源:DRIVER.CPP


示例13: testTheDb

    void testTheDb() {
        stringstream ss;

        setClient("sys.unittest.pdfile");

        /* this is not validly formatted, if you query this namespace bad things will happen */
        theDataFileMgr.insert("sys.unittest.pdfile", (void *) "hello worldx", 13);
        theDataFileMgr.insert("sys.unittest.pdfile", (void *) "hello worldx", 13);

        BSONObj j1((const char *) &js1);
        deleteObjects("sys.unittest.delete", j1, false);
        theDataFileMgr.insert("sys.unittest.delete", &js1, sizeof(js1));
        deleteObjects("sys.unittest.delete", j1, false);
        updateObjects("sys.unittest.delete", j1, j1, true,ss);
        updateObjects("sys.unittest.delete", j1, j1, false,ss);

        auto_ptr<Cursor> c = theDataFileMgr.findAll("sys.unittest.pdfile");
        while ( c->ok() ) {
            c->_current();
            c->advance();
        }
        out() << endl;

        database = 0;
    }
开发者ID:zhuk,项目名称:mongo,代码行数:25,代码来源:db.cpp


示例14: setClient

void
KSpellConfig::sChangeClient( int i )
{
  setClient( i );

  // read in new dict list
  if ( dictcombo ) {
    if ( iclient == KS_CLIENT_ISPELL )
      getAvailDictsIspell();
    else if ( iclient == KS_CLIENT_HSPELL )
    {
      langfnames.clear();
      dictcombo->clear();
      dictcombo->insertItem( i18n("Hebrew") );
      sChangeEncoding( KS_E_CP1255 );
    } else if ( iclient == KS_CLIENT_ZEMBEREK ) {
      langfnames.clear();
      dictcombo->clear();
      dictcombo->insertItem( i18n("Turkish") );
      sChangeEncoding( KS_E_UTF8 );
    }
    else
      getAvailDictsAspell();
  }
  emit configChanged();
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:26,代码来源:ksconfig.cpp


示例15: LOG

SocketStreamHandle::~SocketStreamHandle()
{
    LOG(Network, "SocketStreamHandle %p delete", this);
    // If for some reason we were destroyed without closing, ensure that we are deactivated.
    deactivateHandle(this);
    setClient(0);
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:7,代码来源:SocketStreamHandleSoup.cpp


示例16: MDIFrame

 // Konsttruktor f�r Hauptfenster                                                                                                                                   
 MDIFrame (const char *title,    const IResourceId &r = IC_DEFAULT_FRAME_ID,                                                                                        
 const IFrameWindow::Style &s = defaultStyle ()) :                                                                                                                  
    IFrameWindow (title, r, s),                                                                                                                                     
    Client (0x8008, this, this)                                                                                                                                     
 {                                                                                                                                                                  
     setClient (&Client);                                                                                                                                           
 }                                                                                                                                                                  
开发者ID:OS2World,项目名称:DEV-SAMPLES-ICLUI,代码行数:8,代码来源:MDI.CPP


示例17: setServer

PubSubClient::PubSubClient(IPAddress addr, uint16_t port, Client& client, Stream& stream)
{
	this->_state = MQTT_DISCONNECTED;
	setServer(addr,port);
	setClient(client);
	setStream(stream);
}
开发者ID:malimu,项目名称:MySensors,代码行数:7,代码来源:PubSubClient.cpp


示例18: ERROR_MSG

//-------------------------------------------------------------------------------------
bool ScriptDefModule::addClientMethodDescription(const char* attrName, 
												 MethodDescription* methodDescription)
{
	if(hasPropertyName(attrName))
	{
		ERROR_MSG(fmt::format("ScriptDefModule::addClientMethodDescription: There is a property[{}] name conflict!\n",
			attrName));
		
		return false;
	}
	
	if (hasComponentName(attrName))
	{
		ERROR_MSG(fmt::format("ScriptDefModule::addClientMethodDescription: There is a component[{}] name conflict!\n",
			attrName));

		return false;
	}

	MethodDescription* f_methodDescription = findClientMethodDescription(attrName);
	if(f_methodDescription)
	{
		ERROR_MSG(fmt::format("ScriptDefModule::addClientMethodDescription: [{}] is exist!\n",
			attrName));

		return false;
	}

	setClient(true);
	methodClientDescr_[attrName] = methodDescription;
	methodClientDescr_uidmap_[methodDescription->getUType()] = methodDescription;
	return true;
}
开发者ID:Weooh,项目名称:kbengine,代码行数:34,代码来源:scriptdef_module.cpp


示例19: receivedGetMore

 void receivedGetMore(DbResponse& dbresponse, /*AbstractMessagingPort& dbMsgPort, */Message& m, stringstream& ss) {
     DbMessage d(m);
     const char *ns = d.getns();
     ss << ns;
     setClient(ns);
     cc().top.setRead();
     int ntoreturn = d.pullInt();
     long long cursorid = d.pullInt64();
     ss << " cid:" << cursorid;
     ss << " ntoreturn:" << ntoreturn;
     QueryResult* msgdata;
     try {
         AuthenticationInfo *ai = currentClient.get()->ai;
         uassert("unauthorized", ai->isAuthorized(cc().database()->name.c_str()));
         msgdata = getMore(ns, ntoreturn, cursorid, ss);
     }
     catch ( AssertionException& e ) {
         ss << " exception " + e.toString();
         msgdata = emptyMoreResult(cursorid);
     }
     Message *resp = new Message();
     resp->setData(msgdata, true);
     ss << " bytes:" << resp->data->dataLen();
     ss << " nreturned:" << msgdata->nReturned;
     dbresponse.response = resp;
     dbresponse.responseTo = m.data->id;
     //dbMsgPort.reply(m, resp);
 }
开发者ID:fizx,项目名称:mongo,代码行数:28,代码来源:instance.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ setCmdStr函数代码示例发布时间:2022-05-30
下一篇:
C++ setClassName函数代码示例发布时间: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