mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-06 15:20:54 +03:00
dumb
This commit is contained in:
@@ -77,7 +77,7 @@ final class Heartbeater
|
||||
public void run() {
|
||||
log.debug("Starting");
|
||||
try {
|
||||
while (!Thread.currentThread().isInterrupted()) {
|
||||
while (!isInterrupted()) {
|
||||
final int hi = getPositiveInterval();
|
||||
if (trans.isRunning()) {
|
||||
log.info("Sending heartbeat since {} seconds elapsed", hi);
|
||||
@@ -86,7 +86,7 @@ final class Heartbeater
|
||||
Thread.sleep(hi * 1000);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
if (isInterrupted()) {
|
||||
// We are meant to shut up and draw to a close if interrupted
|
||||
} else
|
||||
trans.die(e);
|
||||
|
||||
@@ -41,22 +41,20 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
final class Reader
|
||||
public final class Reader
|
||||
extends Thread {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final TransportImpl trans;
|
||||
|
||||
Reader(TransportImpl trans) {
|
||||
public Reader(TransportImpl trans) {
|
||||
this.trans = trans;
|
||||
setName("reader");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final Thread curThread = Thread.currentThread();
|
||||
|
||||
try {
|
||||
|
||||
final Decoder decoder = trans.getDecoder();
|
||||
@@ -66,7 +64,7 @@ final class Reader
|
||||
|
||||
int needed = 1;
|
||||
|
||||
while (!curThread.isInterrupted()) {
|
||||
while (!isInterrupted()) {
|
||||
int read = inp.read(recvbuf, 0, needed);
|
||||
if (read == -1)
|
||||
throw new TransportException("Broken transport; encountered EOF");
|
||||
@@ -75,7 +73,7 @@ final class Reader
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
if (curThread.isInterrupted()) {
|
||||
if (isInterrupted()) {
|
||||
// We are meant to shut up and draw to a close if interrupted
|
||||
} else
|
||||
trans.die(e);
|
||||
|
||||
Reference in New Issue
Block a user