fixes for correct list output
This commit is contained in:
parent
c82fd14d61
commit
6f39713366
@ -19,7 +19,7 @@ namespace bsmd.AIS2Service
|
|||||||
private TcpClient tcpSocket;
|
private TcpClient tcpSocket;
|
||||||
private Thread _thread;
|
private Thread _thread;
|
||||||
|
|
||||||
private const int sleepRetry = 30000;
|
private const int sleepRetry = 60000;
|
||||||
private const int maxRetries = 3;
|
private const int maxRetries = 3;
|
||||||
|
|
||||||
private static readonly ILog _log = LogManager.GetLogger(typeof(SerialTCPReader));
|
private static readonly ILog _log = LogManager.GetLogger(typeof(SerialTCPReader));
|
||||||
@ -56,12 +56,17 @@ namespace bsmd.AIS2Service
|
|||||||
{
|
{
|
||||||
_log.WarnFormat("Exception occurred on serial reader: {0}", ex.Message);
|
_log.WarnFormat("Exception occurred on serial reader: {0}", ex.Message);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
this.tcpSocket?.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool Connect()
|
private bool Connect()
|
||||||
{
|
{
|
||||||
int retryCounter = 0;
|
int retryCounter = 0;
|
||||||
|
int retryTime = sleepRetry;
|
||||||
while (retryCounter < maxRetries)
|
while (retryCounter < maxRetries)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -73,8 +78,9 @@ namespace bsmd.AIS2Service
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
retryCounter++;
|
retryCounter++;
|
||||||
|
retryTime *= 2;
|
||||||
_log.WarnFormat("connect failed: {0}, retrying {1}", ex.Message, retryCounter);
|
_log.WarnFormat("connect failed: {0}, retrying {1}", ex.Message, retryCounter);
|
||||||
Thread.Sleep(sleepRetry);
|
Thread.Sleep(retryTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
function update() {
|
function update() {
|
||||||
fetch('http://localhost:9050/api/ais')
|
fetch('http://192.168.2.25:9050/api/ais')
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
return response.json();
|
return response.json();
|
||||||
})
|
})
|
||||||
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
if(row == null) { // not found, create new row
|
if(row == null) { // not found, create new row
|
||||||
row = document.createElement('tr');
|
row = document.createElement('tr');
|
||||||
|
row.setAttribute("id", row_id);
|
||||||
row.innerHTML = `<td>` + data[i].MMSI +
|
row.innerHTML = `<td>` + data[i].MMSI +
|
||||||
`</td><td id="name_` + data[i].MMSI + `"/>` +
|
`</td><td id="name_` + data[i].MMSI + `"/>` +
|
||||||
`<td id="timestamp_` + data[i].MMSI + `"/>` +
|
`<td id="timestamp_` + data[i].MMSI + `"/>` +
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user