public void SendCommandFromAllClients(MessageDescript descript) { foreach (var client in Clients) { sendner.asynSendMessageFromClient(descript, client.Value, allocSendedMessageFromClient, allocDropClientSendMessage); } }
public InfoSendRecvest(MessageDescript descript, ClientInfo client, Action <ClientInfo, MessageDescript> allocToSendedMessage, Action <ClientInfo, Exception> allocToDropSendClient) { Descript = descript; Client = client; AllocToSendedMessage = allocToSendedMessage; AllocToDropSendClient = allocToDropSendClient; }
private void DoTemplate(NetServer server, NetClient client, MessageDescript descript) { if (client != null) { OnGetCommandClientLogic(client, descript.Message); } if (server != null) { OnGetCommandServerLogic(server, descript.Message); } }
public void GetCommandTemplate(NetServer server, NetClient client, MessageDescript descript) { if (isWorkInMainThread) { var info = new InfoMethodLoop(server, client, descript, DoTemplate); TNFManager.Iterator.AddTask(info); } else { DoTemplate(server, client, descript); } }
public void asynSendMessageFromClient(MessageDescript descript, ClientInfo client, Action <ClientInfo, MessageDescript> allocToSendedMessage, Action <ClientInfo, Exception> allocToDropSendClient) { InfoSendRecvest info = new InfoSendRecvest(descript, client, allocToSendedMessage, allocToDropSendClient); sendRecvests.Enqueue(info); if (sendingNow) { return; } sendingNow = true; StartProtectedThread(SendingQueue); }
private void SendMessage(MessageDescript descript, ClientInfo client, Action <ClientInfo, MessageDescript> allocToSendedMessage, Action <ClientInfo, Exception> allocToDropSendClient) { lock (locker) { try { var stream = client.ClientTCP.GetStream(); stream.Write(descript.Buffer, 0, descript.Buffer.Length); allocToSendedMessage(client, descript); } catch (Exception e) { lock (locker) { allocToDropSendClient(client, e); } } } }
private void allocSendedMessageFromClient(ClientInfo client, MessageDescript descript) { }
private void allocSended(ClientInfo info, MessageDescript descript) { DebugAdapter.Log($"Sended: {descript.Message}"); }