LocalPortForwarder.listen() is not interruptible
- Dominant language
- Java
- Stars
- 2.7k
- Forks
- 620
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 11
Description
Hi,
I have had the problem of not being able to stop the LocalPortForwarder once it started if there were no outgoing connections to cause the ServerSocket to fire an accept.
My solution in the LocalPortForwarder listen() method:
``` java
serverSocket.setSoTimeout(500);
while (!Thread.currentThread().isInterrupted()) {
try{
final Socket socket = serverSocket.accept();
log.debug("Got connection from {}", socket.getRemoteSocketAddress());
openChannel(socket).start();
} catch (SocketTimeoutException e){
//Do nothing, just reset for the while to do another loop
}
}
```
Solution is not tested.
All the best,
Daniel.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.