sijie commented on a change in pull request #297: Issue 296: Bookie supports
ephemeral port
URL: https://github.com/apache/bookkeeper/pull/297#discussion_r129768404
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieNettyServer.java
##########
@@ -219,7 +225,12 @@ protected void initChannel(SocketChannel ch) throws
Exception {
});
// Bind and start to accept incoming connections
- bootstrap.bind(address.getAddress(), address.getPort()).sync();
+ Channel listen = bootstrap.bind(address.getAddress(),
address.getPort()).sync().channel();
+ if (listen.localAddress() instanceof InetSocketAddress) {
+ if (conf.getBookiePort() == 0) {
+ conf.setBookiePort(((InetSocketAddress)
listen.localAddress()).getPort());
Review comment:
@eolivelli currently bookie and netty server are separated, there is not
cross referencing in between. The setBookiePort is propagated the real port to
bookie for it to advertise its network location. you can't easily do
getBookieSocketAddress() without any major refactor between bookie and netty
server.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services