Automatically adds a mapping for TCP when running on EC2.
This commit is contained in:
parent
4f4b5005f9
commit
471f91b364
@ -210,7 +210,7 @@ public class AwsCandidateHarvester
|
||||
* @return <tt>true</tt> if there appear to be decent chances for this
|
||||
* machine to be an AWS EC2 and <tt>false</tt> otherwise.
|
||||
*/
|
||||
public static boolean smellsLikeAnEC2()
|
||||
public synchronized static boolean smellsLikeAnEC2()
|
||||
{
|
||||
if (RUNNING_ON_EC2 == null)
|
||||
{
|
||||
|
||||
@ -628,6 +628,17 @@ public class MultiplexingTcpHostHarvester
|
||||
serverSocketChannels.add(channel);
|
||||
}
|
||||
|
||||
// Automatically add a mapping if we're on EC2
|
||||
TransportAddress ec2Face = AwsCandidateHarvester.getFace();
|
||||
TransportAddress ec2Mask;
|
||||
if (ec2Face != null &&
|
||||
(ec2Mask = AwsCandidateHarvester.getMask()) != null)
|
||||
{
|
||||
addMappedAddress(ec2Mask.getAddress(), ec2Face.getAddress());
|
||||
logger.info("Adding an EC2 mapping for TCP: "
|
||||
+ ec2Face + "->" + ec2Mask);
|
||||
}
|
||||
|
||||
acceptThread = new AcceptThread();
|
||||
acceptThread.start();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user