What is the proper way to deny/drop incoming connection to a Reactor TcpServer?
I currently have following:
TcpServer.create()
.doOnConnection {
if (notAllowed(it.address()) {
throw IllegalStateException("Connection from ${it.address()} denied")
}
}
.handle(...)
.bindNow()
It seems to be working and it successfully drops connections from remote addresses which are in my notAllowed
list. But each time it prints the stack trace to the console, and in general it doesn't look good.
What is the proper approach for denying some connections to TcpServer?
question from:
https://stackoverflow.com/questions/65930374/reactor-tcpserver-drop-incoming-connection 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…