Esempio n. 1
0
    void ReplSource::save() {
        BSONObjBuilder b;
        verify( !hostName.empty() );
        b.append("host", hostName);
        // todo: finish allowing multiple source configs.
        // this line doesn't work right when source is null, if that is allowed as it is now:
        //b.append("source", _sourceName);
        BSONObj pattern = b.done();

        BSONObj o = jsobj();
        LOG( 1 ) << "Saving repl source: " << o << endl;

        {
            OpDebug debug;
            Client::Context ctx("local.sources");

            UpdateResult res = update(
                UpdateRequest(NamespaceString("local.sources"), debug)
                .query(pattern)
                .updates(o)
                .upsert());

            verify( ! res.modifiers );
            verify( res.numMatched == 1 );
        }
    }
void C4Network2Players::RequestPlayerInfoUpdate(const class C4ClientPlayerInfos &rRequest)
{
	// network only
	assert(::Network.isEnabled());
	// host or client?
	if (::Network.isHost())
	{
		// host processes directly
		HandlePlayerInfoUpdRequest(&rRequest, true);
	}
	else
	{
		// client sends request to host
		C4PacketPlayerInfoUpdRequest UpdateRequest(rRequest);
		::Network.Clients.SendMsgToHost(MkC4NetIOPacket(PID_PlayerInfoUpdReq, UpdateRequest));
	}
}