Skip to content

Commit

Permalink
Fix dropped packets
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Jan 29, 2025
1 parent 8bf99da commit d300321
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,27 @@ public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(

if (count != null && count > RPCConstants.LOGIN_RATE_LIMIT) {
status = Status.RESOURCE_EXHAUSTED.withDescription("Too many login attempts");
} else {
return Contexts.interceptCall(
Context.current(),
serverCall,
metadata,
serverCallHandler
);
}
}
}

serverCall.close(status, new Metadata());
return new ServerCall.Listener<>() {
// noop
};
serverCall.close(status, new Metadata());
return new ServerCall.Listener<>() {
// noop
};
} else {
return Contexts.interceptCall(
Context.current(),
serverCall,
metadata,
serverCallHandler
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import java.net.InetSocketAddress;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;

/**
* The RPC server for the SoulFire server.
Expand Down Expand Up @@ -88,8 +89,10 @@ public RPCServer(
var grpcService =
GrpcService.builder()
.autoCompression(true)
.intercept(new JwtServerInterceptor(authSystem))
.intercept(new LoginRateLimitingInterceptor())
.intercept(List.of(
new LoginRateLimitingInterceptor(),
new JwtServerInterceptor(authSystem)
))
.addService(injector.getSingleton(LogServiceImpl.class))
.addService(injector.getSingleton(ConfigServiceImpl.class))
.addService(injector.getSingleton(CommandServiceImpl.class))
Expand Down

0 comments on commit d300321

Please sign in to comment.