diff --git a/IOB-WIN/AdapterForm.cs b/IOB-WIN/AdapterForm.cs
index b991d0d6..7c4eb0b0 100644
--- a/IOB-WIN/AdapterForm.cs
+++ b/IOB-WIN/AdapterForm.cs
@@ -216,8 +216,16 @@ namespace IOB_WIN
try
{
- // segnalo reboot (programma)...
- iobObj.callUrl(iobObj.urlReboot);
+ // verifico server online...
+ if (iobObj.checkServerAlive)
+ {
+ // segnalo reboot (programma)...
+ iobObj.callUrl(iobObj.urlReboot);
+ }
+ else
+ {
+ displayTaskAndLog("Server OFFLINE");
+ }
}
catch (Exception exc)
{
diff --git a/IOB-WIN/IobGeneric.cs b/IOB-WIN/IobGeneric.cs
index b7a29cfe..ea54708f 100644
--- a/IOB-WIN/IobGeneric.cs
+++ b/IOB-WIN/IobGeneric.cs
@@ -1312,40 +1312,66 @@ namespace IOB_WIN
return answ;
}
///
+ /// test ping all'indirizzo impostato nei parametri
+ ///
+ ///
+ private IPStatus testPingServer()
+ {
+ IPStatus answ = IPStatus.Unknown; ;
+ IPAddress address;
+ PingReply reply;
+ Ping pingSender = new Ping();
+ address = IPAddress.Loopback;
+ string ipAdrr = currIobConf.serverData.MPIP.Replace("http://", "").Replace("https://", "");
+ IPAddress.TryParse(ipAdrr, out address);
+ reply = pingSender.Send(address, 100);
+ answ = reply.Status;
+ return answ;
+ }
+ ///
/// Verifica se il server sia ALIVE
///
- private bool checkServerAlive
+ public bool checkServerAlive
{
get
{
bool answ = false;
if (DemoOut)
{
- answ = true;
+ answ = false;
}
else
{
- try
+ IPStatus pingStatus = testPingServer();
+ // se passa il ping faccio il resto...
+ if (pingStatus == IPStatus.Success)
{
- // chiamo URL, se restituisce "OK" è alive!
- answ = (callUrl(urlAlive) == "OK");
+ try
+ {
+ // chiamo URL, se restituisce "OK" è alive!
+ answ = (callUrl(urlAlive) == "OK");
+ }
+ catch
+ { }
+ // verifico SE è variato stato online/offline...
+ if (MPOnline != answ)
+ {
+ // se ORA sono online riporto...
+ if (answ)
+ {
+ lgInfo("SERVER ONLINE");
+ }
+ else
+ {
+ lgInfo("SERVER OFFLINE");
+ }
+ // salvo nuovo status...
+ MPOnline = answ;
+ }
}
- catch
- { }
- // verifico SE è variato stato online/offline...
- if (MPOnline != answ)
+ else
{
- // se ORA sono online riporto...
- if (answ)
- {
- lgInfo("SERVER ONLINE");
- }
- else
- {
- lgInfo("SERVER OFFLINE");
- }
- // salvo nuovo status...
- MPOnline = answ;
+ lgInfo("SERVER NOT RESPONDING (PING)");
}
}
return answ;
diff --git a/IOB-WIN/MainForm.cs b/IOB-WIN/MainForm.cs
index 16d00235..556f6c47 100644
--- a/IOB-WIN/MainForm.cs
+++ b/IOB-WIN/MainForm.cs
@@ -14,6 +14,7 @@ using NLog.Targets;
using NLog.Config;
using System.Configuration;
using System.Net;
+using System.Net.NetworkInformation;
namespace IOB_WIN
{
@@ -274,8 +275,17 @@ namespace IOB_WIN
}
try
{
- // segnalo reboot (programma)...
- utils.callUrl(urlReboot);
+ IPStatus pingStatus = testPingServer();
+ // se passa il ping faccio il resto...
+ if (pingStatus == IPStatus.Success)
+ {
+ // segnalo reboot (programma)...
+ utils.callUrl(urlReboot);
+ }
+ else
+ {
+ displayTaskAndLog("Server unreachable, cannot send urlReboot for MAIN FORM");
+ }
}
catch (Exception exc)
{
@@ -284,6 +294,23 @@ namespace IOB_WIN
displayTaskAndLog("Main Form OK");
}
///
+ /// test ping all'indirizzo impostato nei parametri
+ ///
+ ///
+ private IPStatus testPingServer()
+ {
+ IPStatus answ = IPStatus.Unknown; ;
+ IPAddress address;
+ PingReply reply;
+ Ping pingSender = new Ping();
+ address = IPAddress.Loopback;
+ string ipAdrr = MPIP;
+ IPAddress.TryParse(ipAdrr, out address);
+ reply = pingSender.Send(address, 100);
+ answ = reply.Status;
+ return answ;
+ }
+ ///
/// Avvio gli adapters richeisti
///
private void startAdapters()
@@ -409,8 +436,7 @@ namespace IOB_WIN
/// Apre la finestra child con conf
///
protected void openChild(string IOB)
- {
- // !!!FARE!!! x ora è finto... vanno aperti veri adapters
+ {
if (IOB == null)
{
throw new ArgumentNullException(nameof(IOB));
diff --git a/Jenkinsfile b/Jenkinsfile
index 5e4ac68a..b2242daa 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -14,7 +14,7 @@ pipeline {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
- withEnv(['NEXT_BUILD_NUMBER=270']) {
+ withEnv(['NEXT_BUILD_NUMBER=271']) {
// env.versionNumber = VersionNumber(versionNumberString : '1.18.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '1.18.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'MAPO-IOB-WIN'