Molti fix x sistemare disconnessioni (speriamo...)

This commit is contained in:
Samuele E. Locatelli
2019-10-24 00:01:30 +02:00
parent aaad93db04
commit 3abf28af93
11 changed files with 248 additions and 69 deletions
+25
View File
@@ -52,15 +52,34 @@
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions.Desktop, Version=1.0.168.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.6.7\lib\net40-client\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO, Version=2.6.8.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.1.1.8\lib\net40\System.IO.dll</HintPath>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.Numerics" />
<Reference Include="System.Runtime, Version=2.6.8.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.1.1.8\lib\net40\System.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Threading.Tasks, Version=2.6.8.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.1.1.8\lib\net40\System.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@@ -81,7 +100,13 @@
<Content Include="ExtLib\S_Fwlib32_V6.3.1.exe" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
<Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
</Target>
</Project>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.8.0" newVersion="2.6.8.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.8.0" newVersion="2.6.8.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+8
View File
@@ -8,6 +8,7 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Threading.Tasks;
namespace IOB_UT
{
@@ -496,6 +497,13 @@ namespace IOB_UT
return answ;
}
public static string callUrlAsync(string URL)
{
// Chiamo in modalità task...
var resp = TaskEx.Run(() => callUrl(URL));
return resp.Result;
}
/// <summary>
/// provvede a verificare la dim della cartella dei log e cancella i + vecchi fino a restare a dim inferiori a _logMaxMb
/// </summary>
+3
View File
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl" version="1.1.8" targetFramework="net40-client" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net40-client" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net40-client" />
<package id="NLog" version="4.6.7" targetFramework="net40-client" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net40-client" />
</packages>
+56 -13
View File
@@ -93,6 +93,9 @@
this.chkEdit = new System.Windows.Forms.CheckBox();
this.btnSendPLC = new System.Windows.Forms.Button();
this.btnOpenLog = new System.Windows.Forms.Button();
this.lblQueueLenTop = new System.Windows.Forms.Label();
this.label21 = new System.Windows.Forms.Label();
this.lblQueueFLogLen = new System.Windows.Forms.Label();
this.statusStrip1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.tabData.SuspendLayout();
@@ -143,22 +146,24 @@
//
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel1.ColumnCount = 8;
this.tableLayoutPanel1.ColumnCount = 9;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 32F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 70F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 70F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 70F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 54F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 54F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 32F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 32F));
this.tableLayoutPanel1.Controls.Add(this.restart, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.stop, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.nLines, 6, 0);
this.tableLayoutPanel1.Controls.Add(this.nLines, 7, 0);
this.tableLayoutPanel1.Controls.Add(this.start, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.bIN, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.bOUT, 7, 0);
this.tableLayoutPanel1.Controls.Add(this.bOUT, 8, 0);
this.tableLayoutPanel1.Controls.Add(this.chkForceDequeue, 4, 0);
this.tableLayoutPanel1.Controls.Add(this.lblQueueLenTop, 6, 0);
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 0);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
@@ -449,7 +454,7 @@
//
this.lblComStats.AutoSize = true;
this.lblComStats.Font = new System.Drawing.Font("Arial Narrow", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblComStats.Location = new System.Drawing.Point(140, 154);
this.lblComStats.Location = new System.Drawing.Point(140, 166);
this.lblComStats.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblComStats.Name = "lblComStats";
this.lblComStats.Size = new System.Drawing.Size(19, 17);
@@ -459,7 +464,7 @@
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(19, 153);
this.label11.Location = new System.Drawing.Point(19, 165);
this.label11.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(83, 17);
@@ -470,7 +475,7 @@
//
this.lblStatus.AutoSize = true;
this.lblStatus.Font = new System.Drawing.Font("Arial Narrow", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblStatus.Location = new System.Drawing.Point(140, 122);
this.lblStatus.Location = new System.Drawing.Point(140, 134);
this.lblStatus.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblStatus.Name = "lblStatus";
this.lblStatus.Size = new System.Drawing.Size(17, 17);
@@ -480,7 +485,7 @@
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(19, 122);
this.label10.Location = new System.Drawing.Point(19, 134);
this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(48, 17);
@@ -491,7 +496,7 @@
//
this.lblQueueLen.AutoSize = true;
this.lblQueueLen.Font = new System.Drawing.Font("Arial Narrow", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblQueueLen.Location = new System.Drawing.Point(140, 90);
this.lblQueueLen.Location = new System.Drawing.Point(140, 81);
this.lblQueueLen.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblQueueLen.Name = "lblQueueLen";
this.lblQueueLen.Size = new System.Drawing.Size(26, 17);
@@ -502,7 +507,7 @@
//
this.lblDataProc.AutoSize = true;
this.lblDataProc.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblDataProc.Location = new System.Drawing.Point(140, 61);
this.lblDataProc.Location = new System.Drawing.Point(140, 54);
this.lblDataProc.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblDataProc.Name = "lblDataProc";
this.lblDataProc.Size = new System.Drawing.Size(26, 17);
@@ -512,17 +517,17 @@
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(19, 91);
this.label9.Location = new System.Drawing.Point(19, 82);
this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(98, 17);
this.label9.Size = new System.Drawing.Size(114, 17);
this.label9.TabIndex = 81;
this.label9.Text = "Queue lenght:";
this.label9.Text = "Event Queue len";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(19, 61);
this.label8.Location = new System.Drawing.Point(19, 54);
this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(113, 17);
@@ -589,6 +594,8 @@
// panel1
//
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panel1.Controls.Add(this.label21);
this.panel1.Controls.Add(this.lblQueueFLogLen);
this.panel1.Controls.Add(this.lblStatus);
this.panel1.Controls.Add(this.lblComStats);
this.panel1.Controls.Add(this.label1);
@@ -853,6 +860,39 @@
this.btnOpenLog.UseVisualStyleBackColor = true;
this.btnOpenLog.Click += new System.EventHandler(this.BtnOpenLog_Click);
//
// lblQueueLenTop
//
this.lblQueueLenTop.AutoEllipsis = true;
this.lblQueueLenTop.AutoSize = true;
this.lblQueueLenTop.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblQueueLenTop.Location = new System.Drawing.Point(353, 0);
this.lblQueueLenTop.Name = "lblQueueLenTop";
this.lblQueueLenTop.Size = new System.Drawing.Size(861, 37);
this.lblQueueLenTop.TabIndex = 81;
this.lblQueueLenTop.Text = "000";
this.lblQueueLenTop.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label21
//
this.label21.AutoSize = true;
this.label21.Location = new System.Drawing.Point(18, 110);
this.label21.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(110, 17);
this.label21.TabIndex = 88;
this.label21.Text = "FLog Queue len";
//
// lblQueueFLogLen
//
this.lblQueueFLogLen.AutoSize = true;
this.lblQueueFLogLen.Font = new System.Drawing.Font("Arial Narrow", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblQueueFLogLen.Location = new System.Drawing.Point(139, 109);
this.lblQueueFLogLen.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblQueueFLogLen.Name = "lblQueueFLogLen";
this.lblQueueFLogLen.Size = new System.Drawing.Size(26, 17);
this.lblQueueFLogLen.TabIndex = 89;
this.lblQueueFLogLen.Text = "###";
//
// AdapterForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
@@ -959,5 +999,8 @@
private System.Windows.Forms.TextBox txtItemCode;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Button btnOpenLog;
private System.Windows.Forms.Label lblQueueLenTop;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.Label lblQueueFLogLen;
}
}
+60 -13
View File
@@ -277,7 +277,7 @@ namespace IOB_WIN
if (iobObj.checkServerAlive)
{
// segnalo reboot (programma)...
iobObj.callUrl(iobObj.urlReboot);
iobObj.callUrl(iobObj.urlReboot, true);
}
else
{
@@ -440,7 +440,8 @@ namespace IOB_WIN
private void refreshFormData()
{
// aggiorno visualizzazioni varie in form...
queueLenLabel = iobObj.QueueIN.Count.ToString();
evQueueLen = iobObj.QueueIN.Count;
flQueueLen = iobObj.QueueFLog.Count;
}
private void gather_Tick(object sender, EventArgs e)
{
@@ -604,7 +605,7 @@ namespace IOB_WIN
// inizializzio conf IOB
IOBConf = new IobConfiguration
{
pingMsTimeout = fIni.ReadInteger("IOB", "PING_MS_TIMEOUT", 250),
pingMsTimeout = fIni.ReadInteger("IOB", "PING_MS_TIMEOUT", 500),
vendor = curVendor,
model = curModel,
tipoIob = tipoScelto,
@@ -795,7 +796,8 @@ namespace IOB_WIN
{
stop.Enabled = false;
queueLenLabel = "ND";
evQueueLen = 0;
flQueueLen = 0;
nLine2show = utils.CRI("numRowConsole");
}
/// <summary>
@@ -874,6 +876,9 @@ namespace IOB_WIN
slowCount = utils.CRI("slowCount");
verySlowCount = utils.CRI("verySlowCount");
displayTaskAndLog("Adapter Running...");
// init max queue
maxEvQueue = 1;
maxFlQueue = 1;
// forzo check allarmi..
iobObj.forceAlarmCheck();
@@ -1017,18 +1022,60 @@ namespace IOB_WIN
lblDataProc.Text = value;
}
}
/// <summary>
/// label del numero di record processati (libera)
/// </summary>
public string queueLenLabel
protected int maxEvQueue { get; set; }
protected int maxFlQueue { get; set; }
protected int qEvLen { get; set; }
protected int qFlLen { get; set; }
public int evQueueLen
{
get
{
return lblQueueLen.Text;
}
set
{
lblQueueLen.Text = value;
qEvLen = value;
lblQueueLen.Text = qEvLen.ToString();
int totQueue = qEvLen + qFlLen;
lblQueueLenTop.Text = totQueue == 0 ? "realtime" : $"{totQueue} (waiting)";
// se supero max precedente, ed è > 10... loggo!
if (qEvLen > maxEvQueue && qEvLen > 10)
{
maxEvQueue = qEvLen;
lgInfo($"[WARN] Coda EV di {value} record");
}
else
{
maxEvQueue--;
maxEvQueue = maxEvQueue < qEvLen ? qEvLen : maxEvQueue;
}
}
get
{
return qEvLen;
}
}
public int flQueueLen
{
set
{
qFlLen = value;
lblQueueFLogLen.Text = qFlLen.ToString();
int totQueue = qEvLen + qFlLen;
lblQueueLenTop.Text = totQueue == 0 ? "realtime" : $"{totQueue} (waiting)";
// se supero max precedente, ed è > 10... loggo!
if (qFlLen > maxFlQueue && qFlLen > 10)
{
maxFlQueue = qFlLen;
lgInfo($"[WARN] Coda FLog di {value} record");
}
else
{
maxFlQueue--;
maxFlQueue = maxFlQueue < qFlLen ? qFlLen : maxFlQueue;
}
}
get
{
return qFlLen;
}
}
/// <summary>
+3 -3
View File
@@ -17,7 +17,7 @@
<add key="doStartMemDump" value="false" />
<add key="doSampleMemory" value="false" />
<add key="basePrgMemPath" value="CNCMEMUSER" />
<add key="pingMsTimeout" value="500" />
<add key="pingMsTimeout" value="1500" />
<add key="urlCallTOut" value="1500" />
<!-- ciclo corto x invio a server: ms -->
<add key="timerIntMs" value="10" />
@@ -29,12 +29,12 @@
<add key="waitEndCycle" value="0" />
<add key="comCheckTOut" value="10" />
<!-- watchdog, ping, check disconnesso -->
<add key="nMaxSend" value="5" />
<add key="nMaxSend" value="10" />
<add key="pingTestSec" value="5" />
<add key="watchdogMaxSec" value="90" />
<add key="disconMaxSec" value="60" />
<add key="defIOB" value="2999" />
<add key="pauseSendMSec" value="5000" />
<add key="pauseSendMSec" value="1000" />
<!--Modalità DEMO: DemoOUT indica che NON invia davvero al server e DemoIN che simula e NON legge da PLC-->
<add key="DemoIn" value="false" />
<add key="DemoInSample" value="false" />
+15 -8
View File
@@ -20,19 +20,26 @@ CMDIOB2CALL=/IOB/getIob2call?GWIP=
;STARTLIST=3018,3019
;STARTLIST=WPS
;LASCO
;STARTLIST=VL22
;SAET FORNO
;STARTLIST=VL22
;SAET TEMPRA
;STARTLIST=VL20
;COMUR DENTA
STARTLIST=VL22
;STARTLIST=VL21
;STARTLIST=SIMUL_01
;LASCO
;STARTLIST=VL22
;PRESSOIL CEI
;STARTLIST=VL23
;SAET FORNO
;STARTLIST=VL24
;AUTOMAZIONE INGENIA
;STARTLIST=VL25
STARTLIST=SIMUL_01
;STARTLIST=SIM_DP_02
;STARTLIST=SIMUL_03,SIMUL_04,SIMUL_05,SIMUL_06,SIMUL_07,SIMUL_08
+3 -3
View File
@@ -12,9 +12,9 @@ IP=127.0.0.1
PORT=0000
[SERVER]
MPIP=http://192.168.1.4
;MPIP=http://192.168.1.4
;MPIP=http://192.168.214.4
;MPIP=http://10.74.82.218
MPIP=http://10.74.82.218
MPURL=/MP/IO
CMDBASE=/IOB/input/
CMDFLOG=/IOB/flog/
@@ -47,7 +47,7 @@ SIM_MANU=50|6
; indica gestione e simulazione bit 5 --> slow/emergenza
SIM_SLOW=3600|20
; indica simulazione delle funzionalità power ON/ OFF
SIM_POW_ON_OFF=true
SIM_POW_ON_OFF=false
T_ON=7
T_OFF=22
+54 -23
View File
@@ -9,6 +9,7 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Threading.Tasks;
namespace IOB_WIN
{
@@ -459,7 +460,7 @@ namespace IOB_WIN
{ }
}
/// <summary>
/// Effettua logging INFO corretto impostanto anche la variabile IOB prima di scrivere...
/// </summary>
@@ -1831,10 +1832,24 @@ namespace IOB_WIN
/// Effettua chiamata URL e restituisce risultato
/// </summary>
/// <param name="URL"></param>
/// <param name="doAsync">invio in modalità async (NON GARANTITO ordine...)</param>
/// <returns></returns>
public string callUrl(string URL)
public string callUrl(string URL, bool doAsync)
{
return utils.callUrl(URL);
string answ = "";
// Chiamata ASINCRONA
if (doAsync)
{
//Task<string> resp = utils.callUrlAsync(URL);
//answ = resp.Result;
answ = utils.callUrlAsync(URL);
}
// chiamata SOLO NORMALE SINCRONA...
else
{
answ = utils.callUrl(URL);
}
return answ;
}
/// <summary>
/// test ping all'indirizzo impostato nei parametri
@@ -1880,7 +1895,7 @@ namespace IOB_WIN
try
{
// chiamo URL, se restituisce "OK" è alive!
string callResp = callUrl(urlAlive);
string callResp = callUrl(urlAlive, true);
answ = (callResp == "OK");
}
catch (Exception exc)
@@ -1910,6 +1925,7 @@ namespace IOB_WIN
else
{
lgInfo($"SERVER NOT RESPONDING (PING at {cIobConf.serverData.MPIP})");
MPOnline = false;
// imposto un veto per pauseSendMSec
int pauseSendMSec = utils.CRI("pauseSendMSec");
// aggiungo NOISE... +/- 33%
@@ -1941,7 +1957,7 @@ namespace IOB_WIN
try
{
// chiamo URL, se restituisce "OK" è enabled!
answ = (callUrl(urlIobEnabled) == "OK");
answ = (callUrl(urlIobEnabled, true) == "OK");
}
catch
{ }
@@ -1990,7 +2006,25 @@ namespace IOB_WIN
// invio pacchetto di dati (max da conf)
for (int i = 0; i < nMaxSend; i++)
{
trySendQueuedVal();
if (QueueIN.Count > 0)
{
// recupero ed aggiorno ULTIMO valore...
lastSignInVal = QueueIN.Dequeue();
// se ERA online provo
if (MPOnline)
{
// INVIO!!!
sendToMoonPro(urlType.SignIN, lastSignInVal);
}
else
{
break;
}
}
else
{
break;
}
}
}
else
@@ -2014,20 +2048,6 @@ namespace IOB_WIN
}
}
}
/// <summary>
/// Invio del + vecchio valore in coda (se c'è)
/// </summary>
private void trySendQueuedVal()
{
// SE ho qualcosa in coda...
if (QueueIN.Count > 0)
{
// recupero ed aggiorno ULTIMO valore...
lastSignInVal = QueueIN.Dequeue();
// INVIO!!!
sendToMoonPro(urlType.SignIN, lastSignInVal);
}
}
/// <summary>
/// Processo la coda FLog...
@@ -2058,8 +2078,19 @@ namespace IOB_WIN
// SE ho qualcosa in coda...
if (QueueFLog.Count > 0)
{
// INVIO!!!
sendToMoonPro(urlType.FLog, QueueFLog.Dequeue());
if (MPOnline)
{
// INVIO!!!
sendToMoonPro(urlType.FLog, QueueFLog.Dequeue());
}
else
{
break;
}
}
else
{
break;
}
}
}
@@ -2741,7 +2772,7 @@ namespace IOB_WIN
if (checkServerAlive)
{
// chiamo URL!
string answ = callUrl(lastUrl);
string answ = callUrl(lastUrl, false);
// loggo!
lgInfo(string.Format("[SEND] {0} -> {1}", queueVal, answ));
// se "OK" verde, altrimenti errore --> ROSSO
+6 -6
View File
@@ -138,7 +138,7 @@ namespace IOB_WIN
string rawDataInizio = "";
if (!isMulti)
{
rawDataInizio = callUrl(urlInizioOdlIob);
rawDataInizio = callUrl(urlInizioOdlIob, true);
DateTime.TryParse(rawDataInizio, out inizioOdl);
}
else
@@ -148,7 +148,7 @@ namespace IOB_WIN
foreach (var item in elencoMulti)
{
fullUrl = $"{urlInizioOdlIob}|{item}";
rawDataInizio = callUrl(fullUrl);
rawDataInizio = callUrl(fullUrl, true);
DateTime.TryParse(rawDataInizio, out tmpData);
inizioOdl = (tmpData < inizioOdl) ? tmpData : inizioOdl;
}
@@ -161,7 +161,7 @@ namespace IOB_WIN
if (!isMulti)
{
// controllo SE sono fermo (spento o in manuale) per il periodo minimo richiesto...
rawIdle = callUrl(urlIdleTime);
rawIdle = callUrl(urlIdleTime, true);
int.TryParse(rawIdle, out idlePeriod);
}
else
@@ -171,7 +171,7 @@ namespace IOB_WIN
foreach (var item in elencoMulti)
{
fullUrl = $"{urlIdleTime}|{item}";
rawIdle = callUrl(fullUrl);
rawIdle = callUrl(fullUrl, true);
int.TryParse(rawIdle, out tmpIdle);
idlePeriod = tmpIdle > idlePeriod ? tmpIdle : idlePeriod;
}
@@ -206,7 +206,7 @@ namespace IOB_WIN
if (!isMulti)
{
// invio chiamata URL x reset ODL su macchina
rawSplit = callUrl(urlForceSplit);
rawSplit = callUrl(urlForceSplit, false);
fatto = (rawSplit == "OK") ? true : false;
}
else
@@ -215,7 +215,7 @@ namespace IOB_WIN
{
// invio chiamata URL x reset ODL su macchina, ATTENZIONE scriviamo | al posto di "#" che in URL sarebbe filtrato...
fullUrl = $"{urlForceSplit}|{item}";
rawSplit = callUrl(fullUrl);
rawSplit = callUrl(fullUrl, true);
}
fatto = (rawSplit == "OK") ? true : false;
}