From: <br...@us...> - 2009-02-04 13:56:57
|
Revision: 487 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=487&view=rev Author: brus07 Date: 2009-02-04 13:56:55 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Now can work with many client. (bug this type of work very bad) Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/Connector/SocketServerTask.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGate.cs Modified: ACMServer/trunk/ACMServer/Library/Connector/SocketServerTask.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/SocketServerTask.cs 2009-02-04 13:54:23 UTC (rev 486) +++ ACMServer/trunk/ACMServer/Library/Connector/SocketServerTask.cs 2009-02-04 13:56:55 UTC (rev 487) @@ -38,7 +38,17 @@ { if (message.Description.IndexOf("not check busy") != -1) { - DataSender(message, 0); + for (int index = 0; index < this.CountClients(); index++) + { + try + { + ServerSend(message, index); + //DataSender(message, 0); + } + catch (Exception) + { + } + } return true; } List<int> freeTesters = GetFreeTesters(); @@ -50,6 +60,7 @@ } return false; } + protected virtual void DataSender(SystemMessage message, int clientIndex) { //TODO: dlja cjogo bulo potribno pidkljuchyty EasySocket Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2009-02-04 13:54:23 UTC (rev 486) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGate.cs 2009-02-04 13:56:55 UTC (rev 487) @@ -92,7 +92,7 @@ mes += " " + result.res; OnLogMessage("Receive", mes); - message.Description = "not check busy"; + message.Description += " not check busy"; base.Send(message); dataContainer.Return(result); } @@ -104,7 +104,7 @@ mes += " " + result.res; OnLogMessage("Receive", mes); - message.Description = "not check busy"; + message.Description += " not check busy"; base.Send(message); dataContainer.Return(result.ToResult()); } Modified: ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGate.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGate.cs 2009-02-04 13:54:23 UTC (rev 486) +++ ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGate.cs 2009-02-04 13:56:55 UTC (rev 487) @@ -2,6 +2,7 @@ using AcmContester.Library.LibraryExtention; using AcmContester.Library.Connector; using AcmContester.Library.LibraryExtention.Data; +using System.Collections.Generic; namespace AcmContester.Plugins.TesterPlugins.SocketClientGatePlugin { @@ -11,6 +12,9 @@ SocketClientTask client; + + Dictionary<int, bool> colectSubmitId = new Dictionary<int, bool>(); + private SocketClientGate() { } @@ -41,7 +45,7 @@ bool IsBusy() { OnDataArrived(new SystemMessage("isbusy", "CheckState")); - if (mutex.WaitOne(200, false) == true) + if (mutex.WaitOne(2000, false) == true) { return busyState; } @@ -51,6 +55,7 @@ void SocketClientGate_onDataArrived(SystemMessage message) { + OnAddLogText("Receive", message.Message); if (message.IsType("TestingSubmit") == true) @@ -67,8 +72,12 @@ if (message.IsType("TestingResultIoi")) { ResultIoi res = ResultIoi.CreateFromXml(message.Message); - OnAddLogText("Receive", "ID " + res.Submit.submit.id + " result - " + res.res); - OnDataArrived(message); + if (colectSubmitId.ContainsKey(res.Submit.submit.id) == true) + { + colectSubmitId.Remove(res.Submit.submit.id); + OnAddLogText("Receive", "ID " + res.Submit.submit.id + " result - " + res.res); + OnDataArrived(message); + } } } @@ -95,6 +104,8 @@ } if (message.IsType("TestingSubmitIoi")) { + SubmitIoi submit = SubmitIoi.CreateFromXml(message.Message); + colectSubmitId.Add(submit.submit.id, true); OnAddLogText("Send", message.Message); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |