Changeset 354:38da352c8a19 in finroc_tools_gui-java


Ignore:
Timestamp:
15.07.2019 11:15:24 (2 months ago)
Author:
Max Reichardt <max.reichardt@…>
Branch:
default
Phase:
public
Message:

Fixes bug using the command line options --watchdog-reconnect-timeout and --watchdog-terminate-timeout in combination

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • StatusBar.java

    r352 r354  
    7575    } 
    7676 
    77     public void setStatus(List<ExternalConnection> connections) { 
     77    public void setStatus(final List<ExternalConnection> connections) { 
    7878        if (SwingUtilities.isEventDispatchThread()) { 
    7979            setStatusInternal(connections); 
  • WatchDog.java

    r353 r354  
    4747        long now = System.currentTimeMillis(); 
    4848        long lastAWTUpdateOccuredBefore = 0; 
    49         long insufficientConnectionQualityPeriod = 0; 
     49        long insufficientReconnectConnectionQualityPeriod = 0; 
     50        long insufficientTerminateConnectionQualityPeriod = 0; 
    5051 
    5152        if (StatusBar.lastStatusUpdateTimestamp != 0) { 
     
    5455        List<ExternalConnection> interfaces = fingui.getActiveInterfaces(); 
    5556        if (StatusBar.lastQuality > 0 || interfaces.size() == 0) { 
    56             insufficientConnectionQualitySince = 0; 
     57            insufficientReconnectConnectionQualitySince = 0; 
     58            insufficientTerminateConnectionQualitySince = 0; 
    5759        } else { 
    58             if (insufficientConnectionQualitySince == 0) { 
    59                 insufficientConnectionQualitySince = StatusBar.lastStatusUpdateTimestamp; 
     60            if (insufficientReconnectConnectionQualitySince == 0) { 
     61                insufficientReconnectConnectionQualitySince = StatusBar.lastStatusUpdateTimestamp; 
    6062            } 
    61             insufficientConnectionQualityPeriod = StatusBar.lastStatusUpdateTimestamp - insufficientConnectionQualitySince; 
     63            if (insufficientTerminateConnectionQualitySince == 0) { 
     64                insufficientTerminateConnectionQualitySince = StatusBar.lastStatusUpdateTimestamp; 
     65            } 
     66            insufficientReconnectConnectionQualityPeriod = StatusBar.lastStatusUpdateTimestamp - insufficientReconnectConnectionQualitySince; 
     67            insufficientTerminateConnectionQualityPeriod = StatusBar.lastStatusUpdateTimestamp - insufficientTerminateConnectionQualitySince; 
    6268        } 
    6369 
     
    6571            Log.log(LogLevel.WARNING, "Last AWT thread was more than 10 seconds ago"); 
    6672        } 
    67         long relevantPeriod = Math.max(lastAWTUpdateOccuredBefore, insufficientConnectionQualityPeriod); 
    68         if (terminateTimeout > 0 && relevantPeriod > terminateTimeout) { 
    69             Log.log(LogLevel.ERROR, "Last AWT udpate occured before: " + lastAWTUpdateOccuredBefore + "ms; Insufficient Connection Quality Period: " + insufficientConnectionQualityPeriod + "ms"); 
     73        long relevantReconnectPeriod = Math.max(lastAWTUpdateOccuredBefore, insufficientReconnectConnectionQualityPeriod); 
     74        long relevantTerminatePeriod = Math.max(lastAWTUpdateOccuredBefore, insufficientTerminateConnectionQualityPeriod); 
     75        if (terminateTimeout > 0 && relevantTerminatePeriod > terminateTimeout) { 
     76            Log.log(LogLevel.ERROR, "Last AWT udpate occured before: " + lastAWTUpdateOccuredBefore + "ms; Insufficient Connection Quality Period: " + insufficientTerminateConnectionQualityPeriod + "ms"); 
    7077            Log.log(LogLevel.ERROR, "Exceeded timeout -> Terminating"); 
    7178            System.exit(-1); 
    7279        } 
    73         if (reconnectTimeout > 0 && relevantPeriod > reconnectTimeout) { 
    74             Log.log(LogLevel.WARNING, "Last AWT udpate occured before: " + lastAWTUpdateOccuredBefore + "ms; Insufficient Connection Quality Period: " + insufficientConnectionQualityPeriod + "ms"); 
     80        if (reconnectTimeout > 0 && relevantReconnectPeriod > reconnectTimeout) { 
     81            Log.log(LogLevel.WARNING, "Last AWT udpate occured before: " + lastAWTUpdateOccuredBefore + "ms; Insufficient Connection Quality Period: " + insufficientReconnectConnectionQualityPeriod + "ms"); 
    7582            Log.log(LogLevel.WARNING, "Exceeded timeout -> Reconnecting"); 
    7683 
     
    8289                ec.reconnect(); 
    8390            } 
    84             insufficientConnectionQualitySince = 0; 
     91            insufficientReconnectConnectionQualitySince = 0; 
    8592        } 
    86         //Log.log(LogLevel.DEBUG, "Last AWT udpate occured before: " + lastAWTUpdateOccuredBefore + "ms; Insufficient Connection Quality Period: " + insufficientConnectionQualityPeriod + "ms"); 
     93        Log.log(LogLevel.DEBUG_VERBOSE_1, "Last AWT udpate occured before: " + lastAWTUpdateOccuredBefore + "ms; Insufficient Connection Quality Period: " + insufficientReconnectConnectionQualityPeriod + "ms"); 
    8794    } 
    8895 
     
    95102    } 
    96103 
    97     private long insufficientConnectionQualitySince = 0; 
     104    private long insufficientReconnectConnectionQualitySince = 0; 
     105    private long insufficientTerminateConnectionQualitySince = 0; 
    98106    private long reconnectTimeout = 0; 
    99107    private long terminateTimeout = 0; 
Note: See TracChangeset for help on using the changeset viewer.