We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6ce27a3 commit da14f79Copy full SHA for da14f79
1 file changed
framework/src/main/java/org/tron/core/services/ratelimiter/RuntimeData.java
@@ -2,6 +2,7 @@
2
3
import io.grpc.Grpc;
4
import io.grpc.ServerCall;
5
+import java.net.InetSocketAddress;
6
import javax.servlet.http.HttpServletRequest;
7
import lombok.extern.slf4j.Slf4j;
8
@@ -16,7 +17,9 @@ public RuntimeData(Object o) {
16
17
address = ((HttpServletRequest) o).getRemoteAddr();
18
} else if (o instanceof ServerCall) {
19
try {
- address = ((ServerCall) o).getAttributes().get(Grpc.TRANSPORT_ATTR_REMOTE_ADDR).toString();
20
+ InetSocketAddress s = (InetSocketAddress)
21
+ ((ServerCall) o).getAttributes().get(Grpc.TRANSPORT_ATTR_REMOTE_ADDR);
22
+ address = s.getAddress().getHostAddress();
23
} catch (Exception npe) {
24
logger.warn("the address get from the runtime data is a null value unexpected.");
25
}
0 commit comments