Skip to content

Commit

Permalink
fix #938
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-chu committed Feb 1, 2025
1 parent b3a4139 commit f73f617
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ private void reloadConfig() {

@Override
public @NotNull CheckResult shouldBanPeer(@NotNull Torrent torrent, @NotNull Peer peer, @NotNull Downloader downloader, @NotNull ExecutorService ruleExecuteExecutor) {
if (isHandShaking(peer)) {
return handshaking();
}
return getCache().readCacheButWritePassOnly(this, peer.getPeerAddress().getIp(), () -> {
PeerAddress peerAddress = peer.getPeerAddress();
if (ports.contains(peerAddress.getPort())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ public ReloadResult reloadModule() throws Exception {

@Override
public @NotNull CheckResult shouldBanPeer(@NotNull Torrent torrent, @NotNull Peer peer, @NotNull Downloader downloader, @NotNull ExecutorService ruleExecuteExecutor) {
if (isHandShaking(peer)) {
return handshaking();
}
return getCache().readCacheButWritePassOnly(this, peer.getPeerAddress().getIp(), () -> {
String ip = peer.getPeerAddress().getIp();
List<IPBanResult> results = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ public void reloadConfig() {

@Override
public @NotNull CheckResult shouldBanPeer(@NotNull Torrent torrent, @NotNull Peer peer, @NotNull Downloader downloader, @NotNull ExecutorService ruleExecuteExecutor) {
if (isHandShaking(peer)) {
return handshaking();
}
var reverseDnsLookupString = peer.getPeerAddress().getAddress().toReverseDNSLookupString();
return getCache().readCache(this, reverseDnsLookupString, () -> {
Optional<String> ptr;
Expand Down

0 comments on commit f73f617

Please sign in to comment.