Github user jasobrown commented on a diff in the pull request:
https://github.com/apache/cassandra/pull/184#discussion_r163404318
--- Diff: src/java/org/apache/cassandra/streaming/StreamResultFuture.java
---
@@ -135,11 +136,13 @@ public StreamCoordinator getCoordinator()
return coordinator;
}
- private void attachConnection(InetAddress from, int sessionIndex,
Channel channel)
+ private void attachConnection(InetAddressAndPort from, int
sessionIndex, Channel channel)
{
SocketAddress addr = channel.remoteAddress();
- InetAddress connecting = (addr instanceof InetSocketAddress ?
((InetSocketAddress) addr).getAddress() : from);
- StreamSession session = coordinator.getOrCreateSessionById(from,
sessionIndex, connecting);
+ InetAddress connecting = (addr instanceof InetSocketAddress ?
((InetSocketAddress) addr).getAddress() : from.address);
+ //Need to turn connecting into a InetAddressAndPort with the
correct port. I think getting the port from "from"
+ //Will work since we don't actually have ports diverge across
network interfaces
+ StreamSession session = coordinator.getOrCreateSessionById(from,
sessionIndex, InetAddressAndPort.getByAddressOverrideDefaults(connecting,
from.port));
--- End diff --
Yes are correct; I made a mistake. We should keep your code, but can you
add my comment: `In the case of unit tests, if you use the EmbeddedChannel,
channel.remoteAddress() does not return an InetSocketAddress, but an
EmbeddedSocketAddress. Hence why we need the type check here`
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]