/// <summary> 写入错误日志 /// </summary> /// <param name="protocol">上传数据协议</param> public static void WriteErrorLog(ClientProtocol protocol) { string msg = string.Empty; if (htTable.ContainsKey(protocol.SubMessageId)) { string tableName = string.Empty; //表名: foreach (DictionaryEntry de in htTable) { if (de.Value.ToString() == protocol.SubMessageId) { tableName = de.Key.ToString(); break; } } msg += "表名:" + tableName + "\r\n"; } msg += "标识:" + protocol.StationId + protocol.SerialNumber + protocol.TimeSpan + "\r\n"; msg += "时间:" + TimeHelper.MillisToTime(protocol.TimeSpan) + "\r\n"; msg += "服务站ID:" + protocol.StationId + "\r\n"; msg += "内容:" + ProtocolTranslator.SerilizeMessage(protocol); //写错误日志 Log.writeCloudLog(msg); }
/// <exception cref="System.Exception"/> public Void Run() { string path = ServletUtil.GetDecodedPath(request, "/contentSummary"); PrintWriter @out = response.GetWriter(); XMLOutputter xml = new XMLOutputter(@out, "UTF-8"); xml.Declaration(); try { ClientProtocol nnproxy = this._enclosing.CreateNameNodeProxy(); ContentSummary cs = nnproxy.GetContentSummary(path); xml.StartTag(typeof(ContentSummary).FullName); if (cs != null) { xml.Attribute("length", string.Empty + cs.GetLength()); xml.Attribute("fileCount", string.Empty + cs.GetFileCount()); xml.Attribute("directoryCount", string.Empty + cs.GetDirectoryCount()); xml.Attribute("quota", string.Empty + cs.GetQuota()); xml.Attribute("spaceConsumed", string.Empty + cs.GetSpaceConsumed()); xml.Attribute("spaceQuota", string.Empty + cs.GetSpaceQuota()); } xml.EndTag(); } catch (IOException ioe) { this._enclosing.WriteXml(ioe, path, xml); } xml.EndDocument(); return(null); }
/// <exception cref="System.IO.IOException"/> public Void Run() { ClientProtocol nn = this._enclosing.CreateNameNodeProxy(); string path = ServletUtil.GetDecodedPath(request, "/data"); string encodedPath = ServletUtil.GetRawPath(request, "/data"); string delegationToken = request.GetParameter(JspHelper.DelegationParameterName); HdfsFileStatus info = nn.GetFileInfo(path); if (info != null && !info.IsDir()) { response.SendRedirect(this._enclosing.CreateRedirectURL(path, encodedPath, info, ugi, nn, request, delegationToken).ToString()); } else { if (info == null) { response.SendError(400, "File not found " + path); } else { response.SendError(400, path + ": is a directory"); } } return(null); }
public async void Listen() { try { _tcpListener?.Start(); while (true) { var tcpClient = _tcpListener?.AcceptTcpClient(); var interaction = new ClientProtocol(tcpClient); interaction.ExcecuteCommand = ReadCommand; await interaction.StartAsync(); } } catch (Exception ex) { _logger.LogError($"{ex}"); } finally { _tcpListener?.Stop(); } }
/// <exception cref="System.IO.IOException"/> public NameNodeConnector(string name, URI nameNodeUri, Path idPath, IList <Path> targetPaths , Configuration conf, int maxNotChangedIterations) { this.nameNodeUri = nameNodeUri; this.idPath = idPath; this.targetPaths = targetPaths == null || targetPaths.IsEmpty() ? Arrays.AsList(new Path("/")) : targetPaths; this.maxNotChangedIterations = maxNotChangedIterations; this.namenode = NameNodeProxies.CreateProxy <NamenodeProtocol>(conf, nameNodeUri). GetProxy(); this.client = NameNodeProxies.CreateProxy <ClientProtocol>(conf, nameNodeUri, fallbackToSimpleAuth ).GetProxy(); this.fs = (DistributedFileSystem)FileSystem.Get(nameNodeUri, conf); NamespaceInfo namespaceinfo = namenode.VersionRequest(); this.blockpoolID = namespaceinfo.GetBlockPoolID(); FsServerDefaults defaults = fs.GetServerDefaults(new Path("/")); this.keyManager = new KeyManager(blockpoolID, namenode, defaults.GetEncryptDataTransfer (), conf); // if it is for test, we do not create the id file @out = CheckAndMarkRunning(); if (@out == null) { // Exit if there is another one running. throw new IOException("Another " + name + " is running."); } }
public EncryptionZoneIterator(ClientProtocol namenode, Sampler <object> traceSampler ) : base(Sharpen.Extensions.ValueOf(0)) { this.namenode = namenode; this.traceSampler = traceSampler; }
private void SignRequest(IRequest request, AbstractAWSSigner signer, RequestMetrics metrics) { // Check if request should be signed if (credentials is AnonymousAWSCredentials) { return; } metrics.StartEvent(RequestMetrics.Metric.CredentialsRequestTime); using (ImmutableCredentials immutableCredentials = credentials.GetCredentials()) { metrics.StopEvent(RequestMetrics.Metric.CredentialsRequestTime); if (immutableCredentials.UseToken) { ClientProtocol protocol = DetermineProtocol(signer); switch (protocol) { case ClientProtocol.QueryStringProtocol: request.Parameters["SecurityToken"] = immutableCredentials.Token; break; case ClientProtocol.RestProtocol: request.Headers["x-amz-security-token"] = immutableCredentials.Token; break; default: throw new InvalidDataException("Cannot determine protocol"); } } signer.Sign(request, this.config, immutableCredentials.AccessKey, immutableCredentials.ClearSecretKey, immutableCredentials.SecureSecretKey); } }
/// <summary> /// 2byte - message length /// 2byte - message type /// 4byte - not use /// protobuf /// extern /// </summary> /// <param name="msg"></param> /// <param name="id"></param> /// <returns></returns> public ArraySegment <byte> Encode(object msg, out UInt16 id) { memoryStream.Seek(0, SeekOrigin.Begin); binaryWriter.Seek(0, SeekOrigin.Begin); binaryWriter.Write(UInt16.MinValue); UInt16 msgId = ClientProtocol.GetIdByType(msg.GetType()); #if net_log Debug.Log("encode id is :" + msgId); #endif id = msgId; binaryWriter.Write(msgId); binaryWriter.Write(UInt32.MinValue); RuntimeTypeModel.Default.Serialize(memoryStream, msg); #if net_log Debug.Log("encode after Serialize:" + memoryStream.Position); #endif int totalLength = (int)memoryStream.Position; UInt16 length = (UInt16)(memoryStream.Position - 2); binaryWriter.Seek(0, SeekOrigin.Begin); binaryWriter.Write(length); byte[] fullBuffer = new byte[totalLength]; Array.Copy(this.buffer, fullBuffer, totalLength); ArraySegment <byte> encodeResult = new ArraySegment <byte>(fullBuffer, 0, totalLength); return(encodeResult); }
/// <include file='doc\DiscoveryReference.uex' path='docs/doc[@for="DiscoveryReference.Resolve"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void Resolve() { if (ClientProtocol == null) { throw new InvalidOperationException(Res.GetString(Res.WebResolveMissingClientProtocol)); } if (ClientProtocol.Documents[Url] != null) { return; } string newUrl = Url; string oldUrl = Url; string contentType = null; Stream stream = ClientProtocol.Download(ref newUrl, ref contentType); if (ClientProtocol.Documents[newUrl] != null) { Url = newUrl; return; } try { Url = newUrl; Resolve(contentType, stream); } catch { Url = oldUrl; throw; } finally { stream.Close(); } }
public override bool OnKeyDown(Keys key) { if (DisableKeyboard) { return(false); } if (key == Keys.Enter) { if (Connection.LocalPlayer == Connection.Lobby.Owner) { // Start the game if (ClientProtocol.StartGame()) { DisableKeyboard = !DisableKeyboard; var info = clientInformation.GetComponent <Text>(); info.Message = "Starting game"; ChangeState = true; } else { var info = clientInformation.GetComponent <Text>(); info.Message = "Not enough players!"; } } return(true); } return(false); }
public virtual void TestDelegationTokenRpc() { ClientProtocol mockNN = Org.Mockito.Mockito.Mock <ClientProtocol>(); FSNamesystem mockNameSys = Org.Mockito.Mockito.Mock <FSNamesystem>(); DelegationTokenSecretManager sm = new DelegationTokenSecretManager(DFSConfigKeys. DfsNamenodeDelegationKeyUpdateIntervalDefault, DFSConfigKeys.DfsNamenodeDelegationKeyUpdateIntervalDefault , DFSConfigKeys.DfsNamenodeDelegationTokenMaxLifetimeDefault, 3600000, mockNameSys ); sm.StartThreads(); Org.Apache.Hadoop.Ipc.Server server = new RPC.Builder(conf).SetProtocol(typeof(ClientProtocol )).SetInstance(mockNN).SetBindAddress(Address).SetPort(0).SetNumHandlers(5).SetVerbose (true).SetSecretManager(sm).Build(); server.Start(); UserGroupInformation current = UserGroupInformation.GetCurrentUser(); IPEndPoint addr = NetUtils.GetConnectAddress(server); string user = current.GetUserName(); Text owner = new Text(user); DelegationTokenIdentifier dtId = new DelegationTokenIdentifier(owner, owner, null ); Org.Apache.Hadoop.Security.Token.Token <DelegationTokenIdentifier> token = new Org.Apache.Hadoop.Security.Token.Token <DelegationTokenIdentifier>(dtId, sm); SecurityUtil.SetTokenService(token, addr); Log.Info("Service for token is " + token.GetService()); current.AddToken(token); current.DoAs(new _PrivilegedExceptionAction_100(addr, server)); }
/// <summary>Initializes a new instance of the <see cref="Client"/> class.</summary> internal Client(IConnection connection, ClientProtocol protocol) { this.Protocol = protocol; this.Connection = connection; this.Connection.PacketReceived += this.OnPacketReceived; this.Connection.BeginReceive().ContinueWith(task => this.OnReceiveComplete(task.Exception)); }
/// <summary> /// Signs the request. /// </summary> /// <param name="requestContext">The request context.</param> internal static void SignRequest(IRequestContext requestContext) { ImmutableCredentials immutableCredentials = requestContext.ImmutableCredentials; // credentials would be null in the case of anonymous users getting public resources from S3 if (immutableCredentials == null) { return; } using (requestContext.Metrics.StartEvent(Metric.RequestSigningTime)) { if (immutableCredentials.UseToken) { ClientProtocol protocol = requestContext.Signer.Protocol; switch (protocol) { case ClientProtocol.QueryStringProtocol: requestContext.Request.Parameters["SecurityToken"] = immutableCredentials.Token; break; case ClientProtocol.RestProtocol: requestContext.Request.Headers[HeaderKeys.XAmzSecurityTokenHeader] = immutableCredentials.Token; break; default: throw new InvalidDataException("Cannot determine protocol"); } } requestContext.Signer.Sign(requestContext.Request, requestContext.ClientConfig, requestContext.Metrics, immutableCredentials.AccessKey, immutableCredentials.SecretKey); } }
/// <summary> 获取在线客户端 /// </summary> /// <param name="dr">数据行</param> /// <param name="dbName">帐套</param> /// <returns></returns> private static ClientProtocol GetProtocol(DataRow dr, string dbName) { if (!htTable.ContainsKey(dr.Table.TableName)) { return(null); } ClientProtocol cp = new ClientProtocol(); cp.StationId = GlobalStaticObj_Server.Instance.StationID; //根据表名得到子消息ID if (htTable[dr.Table.TableName] is ProtocolValue) { cp.SubMessageId = (htTable[dr.Table.TableName] as ProtocolValue).MessageId; } else { cp.SubMessageId = htTable[dr.Table.TableName].ToString(); } cp.TimeSpan = TimeHelper.GetTimeInMillis(); //Json对象 string json = JsonHelper.DataTableToJson(dr, cp.StationId, dbName, false); json = BaseCodeHelper.EnCode(json); cp.Json = json; return(cp); }
private void SignRequest(IRequest request, AbstractAWSSigner signer) { using (ImmutableCredentials immutableCredentials = credentials.GetCredentials()) { ValidateAuthentication(immutableCredentials); if (immutableCredentials.UseToken) { ClientProtocol protocol = DetermineProtocol(signer); switch (protocol) { case ClientProtocol.QueryStringProtocol: request.Parameters["SecurityToken"] = immutableCredentials.Token; break; case ClientProtocol.RestProtocol: request.Headers["x-amz-security-token"] = immutableCredentials.Token; break; default: throw new InvalidDataException("Cannot determine protocol"); } } signer.Sign(request, this.config, immutableCredentials.AccessKey, immutableCredentials.ClearSecretKey, immutableCredentials.SecureSecretKey); } }
/// <summary>Create a redirection URL</summary> /// <exception cref="System.IO.IOException"/> private Uri CreateRedirectURL(string path, string encodedPath, HdfsFileStatus status , UserGroupInformation ugi, ClientProtocol nnproxy, HttpServletRequest request, string dt) { string scheme = request.GetScheme(); LocatedBlocks blks = nnproxy.GetBlockLocations(status.GetFullPath(new Path(path)) .ToUri().GetPath(), 0, 1); Configuration conf = NameNodeHttpServer.GetConfFromContext(GetServletContext()); DatanodeID host = PickSrcDatanode(blks, status, conf); string hostname; if (host is DatanodeInfo) { hostname = host.GetHostName(); } else { hostname = host.GetIpAddr(); } int port = "https".Equals(scheme) ? host.GetInfoSecurePort() : host.GetInfoPort(); string dtParam = string.Empty; if (dt != null) { dtParam = JspHelper.GetDelegationTokenUrlParam(dt); } // Add namenode address to the url params NameNode nn = NameNodeHttpServer.GetNameNodeFromContext(GetServletContext()); string addr = nn.GetNameNodeAddressHostPortString(); string addrParam = JspHelper.GetUrlParam(JspHelper.NamenodeAddress, addr); return(new Uri(scheme, hostname, port, "/streamFile" + encodedPath + '?' + "ugi=" + ServletUtil.EncodeQueryValue(ugi.GetShortUserName()) + dtParam + addrParam)); }
public override void init() { // Static message to client EntityUtility.CreateMessage(Domain, "Players in server", 0, 0, 16); // Creates a list of all clients in server List <string> users = ClientProtocol.GetAllUsers(); for (int i = 0; i < users.Count(); i++) { EntityUtility.CreateMessage(Domain, users[i], 0, 0, 18); } // Background Entity backGround = new Entity(Domain); backGround.AddComponent(new Transform()); backGround.AddComponent(new Sprite(Assets.Textures.Background, 1280, 720)); // Menu Entity Menu = new Entity(Domain); Menu.AddComponent(new Transform()); Menu.AddComponent(new Sprite(Assets.Textures.Menu, 600, 600)); // InputBox InputBox = EntityUtility.CreateInput(Domain, "Enter Name", -70, 100, 18); }
/// <summary> /// Create a 4 nodes cluster: 2 nodes (n0, n1) in RACK0/NODEGROUP0, 1 node (n2) /// in RACK1/NODEGROUP1 and 1 node (n3) in RACK1/NODEGROUP2. /// </summary> /// <remarks> /// Create a 4 nodes cluster: 2 nodes (n0, n1) in RACK0/NODEGROUP0, 1 node (n2) /// in RACK1/NODEGROUP1 and 1 node (n3) in RACK1/NODEGROUP2. Fill the cluster /// to 60% and 3 replicas, so n2 and n3 will have replica for all blocks according /// to replica placement policy with NodeGroup. As a result, n2 and n3 will be /// filled with 80% (60% x 4 / 3), and no blocks can be migrated from n2 and n3 /// to n0 or n1 as balancer policy with node group. Thus, we expect the balancer /// to end in 5 iterations without move block process. /// </remarks> /// <exception cref="System.Exception"/> public virtual void TestBalancerEndInNoMoveProgress() { Configuration conf = CreateConf(); long[] capacities = new long[] { Capacity, Capacity, Capacity, Capacity }; string[] racks = new string[] { Rack0, Rack0, Rack1, Rack1 }; string[] nodeGroups = new string[] { Nodegroup0, Nodegroup0, Nodegroup1, Nodegroup2 }; int numOfDatanodes = capacities.Length; NUnit.Framework.Assert.AreEqual(numOfDatanodes, racks.Length); NUnit.Framework.Assert.AreEqual(numOfDatanodes, nodeGroups.Length); MiniDFSCluster.Builder builder = new MiniDFSCluster.Builder(conf).NumDataNodes(capacities .Length).Racks(racks).SimulatedCapacities(capacities); MiniDFSClusterWithNodeGroup.SetNodeGroups(nodeGroups); cluster = new MiniDFSClusterWithNodeGroup(builder); try { cluster.WaitActive(); client = NameNodeProxies.CreateProxy <ClientProtocol>(conf, cluster.GetFileSystem( 0).GetUri()).GetProxy(); long totalCapacity = TestBalancer.Sum(capacities); // fill up the cluster to be 60% full long totalUsedSpace = totalCapacity * 6 / 10; TestBalancer.CreateFile(cluster, filePath, totalUsedSpace / 3, (short)(3), 0); // run balancer which can finish in 5 iterations with no block movement. RunBalancerCanFinish(conf, totalUsedSpace, totalCapacity); } finally { cluster.Shutdown(); } }
public ClientController(IGameController controller) { _controller = controller; var clientProtocol = new ClientProtocol (this); _transport = new ClientTransport (clientProtocol); }
/// <summary> 获取在线客户端 /// </summary> /// <param name="dr">数据行</param> /// <param name="dbName">帐套</param> /// <returns></returns> private static ClientProtocol GetProtocol(DataRow dr, string dbName) { if (!htTable.ContainsKey(dr.Table.TableName)) { return(null); } ClientProtocol cp = new ClientProtocol(); cp.StationId = GlobalStaticObj_Server.Instance.StationID; //根据表名得到子消息ID if (htTable[dr.Table.TableName] is ProtocolValue) { cp.SubMessageId = (htTable[dr.Table.TableName] as ProtocolValue).MessageId; } else { cp.SubMessageId = htTable[dr.Table.TableName].ToString(); } cp.TimeSpan = TimeHelper.GetTimeInMillis(); var sb = new StringBuilder(); foreach (var item in dr.ItemArray) { sb.Append(item); } LogAssistant.LogService.WriteLog(sb); //Json对象 string json = JsonHelper.DataTableToJson(dr, cp.StationId, dbName, false); json = BaseCodeHelper.EnCode(json); cp.Json = json; return(cp); }
public CacheDirectiveIterator(ClientProtocol namenode, CacheDirectiveInfo filter, Sampler <object> traceSampler) : base(0L) { this.namenode = namenode; this.filter = filter; this.traceSampler = traceSampler; }
void ProcessProtocol() { while (protocolQueue.Count > 0) { ClientProtocol protocol = protocolQueue.Dequeue(); protocol.Process(); } }
public virtual void TestClientNamenodeProtocol() { ClientProtocol cp = NameNodeProxies.CreateNonHAProxy <ClientProtocol>(conf, nnAddress , UserGroupInformation.GetCurrentUser(), true).GetProxy(); RpcClientUtil.IsMethodSupported(cp, typeof(ClientNamenodeProtocolPB), RPC.RpcKind .RpcProtocolBuffer, RPC.GetProtocolVersion(typeof(ClientNamenodeProtocolPB)), "mkdirs" ); }
/// <summary> /// Test a cluster with even distribution, then a new empty node is added to /// the cluster. /// </summary> /// <remarks> /// Test a cluster with even distribution, then a new empty node is added to /// the cluster. Test start a cluster with specified number of nodes, and fills /// it to be 30% full (with a single file replicated identically to all /// datanodes); It then adds one new empty node and starts balancing. /// </remarks> /// <exception cref="System.Exception"/> public virtual void TestBalancerWithHANameNodes() { Configuration conf = new HdfsConfiguration(); TestBalancer.InitConf(conf); long newNodeCapacity = TestBalancer.Capacity; // new node's capacity string newNodeRack = TestBalancer.Rack2; // new node's rack // array of racks for original nodes in cluster string[] racks = new string[] { TestBalancer.Rack0, TestBalancer.Rack1 }; // array of capacities of original nodes in cluster long[] capacities = new long[] { TestBalancer.Capacity, TestBalancer.Capacity }; NUnit.Framework.Assert.AreEqual(capacities.Length, racks.Length); int numOfDatanodes = capacities.Length; MiniDFSNNTopology.NNConf nn1Conf = new MiniDFSNNTopology.NNConf("nn1"); nn1Conf.SetIpcPort(NameNode.DefaultPort); Configuration copiedConf = new Configuration(conf); cluster = new MiniDFSCluster.Builder(copiedConf).NnTopology(MiniDFSNNTopology.SimpleHATopology ()).NumDataNodes(capacities.Length).Racks(racks).SimulatedCapacities(capacities) .Build(); HATestUtil.SetFailoverConfigurations(cluster, conf); try { cluster.WaitActive(); cluster.TransitionToActive(1); Sharpen.Thread.Sleep(500); client = NameNodeProxies.CreateProxy <ClientProtocol>(conf, FileSystem.GetDefaultUri (conf)).GetProxy(); long totalCapacity = TestBalancer.Sum(capacities); // fill up the cluster to be 30% full long totalUsedSpace = totalCapacity * 3 / 10; TestBalancer.CreateFile(cluster, TestBalancer.filePath, totalUsedSpace / numOfDatanodes , (short)numOfDatanodes, 1); // start up an empty node with the same capacity and on the same rack cluster.StartDataNodes(conf, 1, true, null, new string[] { newNodeRack }, new long [] { newNodeCapacity }); totalCapacity += newNodeCapacity; TestBalancer.WaitForHeartBeat(totalUsedSpace, totalCapacity, client, cluster); ICollection <URI> namenodes = DFSUtil.GetNsServiceRpcUris(conf); NUnit.Framework.Assert.AreEqual(1, namenodes.Count); NUnit.Framework.Assert.IsTrue(namenodes.Contains(HATestUtil.GetLogicalUri(cluster ))); int r = Org.Apache.Hadoop.Hdfs.Server.Balancer.Balancer.Run(namenodes, Balancer.Parameters .Default, conf); NUnit.Framework.Assert.AreEqual(ExitStatus.Success.GetExitCode(), r); TestBalancer.WaitForBalancer(totalUsedSpace, totalCapacity, client, cluster, Balancer.Parameters .Default); } finally { cluster.Shutdown(); } }
internal void Poll() { TickMethod(); if (ClientConnection.DataAvaliable) { ClientProtocol.ReadClient(); } }
/// <exception cref="System.IO.IOException"/> internal DFSInotifyEventInputStream(Sampler traceSampler, ClientProtocol namenode , long lastReadTxid) { // Only consider new transaction IDs. this.traceSampler = traceSampler; this.namenode = namenode; this.it = Iterators.EmptyIterator(); this.lastReadTxid = lastReadTxid; }
private void ExecuteMultiRequestLocally(WoopsaClientMultiRequest multiRequest) { // Execute multi request locally foreach (var item in multiRequest.ClientRequests) { try { switch (item.Request.Verb) { case WoopsaFormat.VerbMeta: item.Result = new WoopsaClientRequestResult() { ResultType = WoopsaClientRequestResultType.Meta, Meta = ClientProtocol.Meta(item.Request.Path) }; break; case WoopsaFormat.VerbInvoke: item.Result = new WoopsaClientRequestResult() { ResultType = WoopsaClientRequestResultType.Value, Value = ClientProtocol.Invoke(item.Request.Path, item.Request.Arguments.ToNameValueCollection()) }; break; case WoopsaFormat.VerbRead: item.Result = new WoopsaClientRequestResult() { ResultType = WoopsaClientRequestResultType.Value, Value = ClientProtocol.Read(item.Request.Path) }; break; case WoopsaFormat.VerbWrite: ClientProtocol.Write(item.Request.Path, item.Request.Value); item.Result = new WoopsaClientRequestResult() { ResultType = WoopsaClientRequestResultType.Value, Value = WoopsaValue.Null }; break; } } catch (Exception e) { item.Result = new WoopsaClientRequestResult() { ResultType = WoopsaClientRequestResultType.Error, Error = e }; item.IsDone = true; } } }
public TwitchClientFactory( Func <IClientOptions, IClient> clientFactory, ClientProtocol clientProtocol, ILogger <TwitchClient> logger, ICredentialsManager credentialsManager) { ClientFactory = clientFactory; ClientProtocol = clientProtocol; Logger = logger; CredentialsManager = credentialsManager; }
/// <exception cref="System.IO.IOException"/> public static LocatedBlock GetLastLocatedBlock(ClientProtocol namenode, string src ) { //get block info for the last block LocatedBlocks locations = namenode.GetBlockLocations(src, 0, long.MaxValue); IList <LocatedBlock> blocks = locations.GetLocatedBlocks(); DataNode.Log.Info("blocks.size()=" + blocks.Count); NUnit.Framework.Assert.IsTrue(blocks.Count > 0); return(blocks[blocks.Count - 1]); }
// Use this for initialization void Start() { if (cManager.Connect(Config.REMOTE_HOST, Constants.REMOTE_PORT) == ConnectionManager.SUCCESS) { NetworkManager.Send( ClientProtocol.Prepare(Constants.CLIENT_VERSION, Constants.SESSION_ID), ProcessClient ); } StartCoroutine(Poll(Constants.HEARTBEAT_RATE)); }
private void TickStatus() { if (Data.LastLogicState != ClientState.Status) { Data.LastLogicState = ClientState.Status; Data.StatusRequest = false; Data.StatusRespond = false; Data.StatusPing = false; } ClientProtocol.TickStatus(); }
public ClientTransport(ClientProtocol clientProtocol) { _clientProtocol = clientProtocol; }