forked from I2P_Developers/i2p.i2p
- Hide buttons while stopping all
This commit is contained in:
@ -61,6 +61,7 @@ public class SnarkManager implements Snark.CompleteListener {
|
||||
private ConnectionAcceptor _connectionAcceptor;
|
||||
private Thread _monitor;
|
||||
private volatile boolean _running;
|
||||
private volatile boolean _stopping;
|
||||
private final Map<String, Tracker> _trackerMap;
|
||||
|
||||
public static final String PROP_I2CP_HOST = "i2psnark.i2cpHost";
|
||||
@ -164,6 +165,9 @@ public class SnarkManager implements Snark.CompleteListener {
|
||||
stopAllTorrents(true);
|
||||
}
|
||||
|
||||
/** @since 0.9.1 */
|
||||
public boolean isStopping() { return _stopping; }
|
||||
|
||||
/** hook to I2PSnarkUtil for the servlet */
|
||||
public I2PSnarkUtil util() { return _util; }
|
||||
|
||||
@ -1684,6 +1688,7 @@ public class SnarkManager implements Snark.CompleteListener {
|
||||
* @since 0.9.1
|
||||
*/
|
||||
public void stopAllTorrents(boolean finalShutdown) {
|
||||
_stopping = true;
|
||||
if (finalShutdown && _log.shouldLog(Log.WARN))
|
||||
_log.warn("SnarkManager final shutdown");
|
||||
int count = 0;
|
||||
@ -1712,6 +1717,7 @@ public class SnarkManager implements Snark.CompleteListener {
|
||||
}
|
||||
} else {
|
||||
_util.disconnect();
|
||||
_stopping = false;
|
||||
addMessage(_("I2P tunnel closed."));
|
||||
}
|
||||
}
|
||||
@ -1722,6 +1728,7 @@ public class SnarkManager implements Snark.CompleteListener {
|
||||
public void timeReached() {
|
||||
if (_util.connected()) {
|
||||
_util.disconnect();
|
||||
_stopping = false;
|
||||
addMessage(_("I2P tunnel closed."));
|
||||
}
|
||||
}
|
||||
|
@ -408,7 +408,9 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
ua.startsWith("Dillo"));
|
||||
|
||||
boolean noThinsp = isDegraded || (ua != null && ua.startsWith("Opera"));
|
||||
if (_manager.util().connected()) {
|
||||
if (_manager.isStopping()) {
|
||||
out.write(" ");
|
||||
} else if (_manager.util().connected()) {
|
||||
if (isDegraded)
|
||||
out.write("<a href=\"/i2psnark/?action=StopAll&nonce=" + _nonce + "\"><img title=\"");
|
||||
else {
|
||||
@ -1142,6 +1144,7 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
if (isDegraded)
|
||||
out.write("</a>");
|
||||
} else if (!snark.isStarting()) {
|
||||
if (!_manager.isStopping()) {
|
||||
// Start Button
|
||||
// This works in Opera but it's displayed a little differently, so use noThinsp here too so all 3 icons are consistent
|
||||
if (noThinsp)
|
||||
@ -1154,7 +1157,7 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
out.write("\">");
|
||||
if (isDegraded)
|
||||
out.write("</a>");
|
||||
|
||||
}
|
||||
if (isValid) {
|
||||
// Remove Button
|
||||
// Doesnt work with Opera so use noThinsp instead of isDegraded
|
||||
|
Reference in New Issue
Block a user