Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Rosjava Core Gradle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CeTI
ROS
ROS Java Packages
Rosjava Core Gradle
Commits
52d14497
Commit
52d14497
authored
11 years ago
by
Lucas Chiesa
Committed by
Daniel Stonier
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Removed listAllInetAddress private method.
Also renamed getAllInetAddressByName to getAllInetAddressesByName.
parent
d02c9244
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
rosjava/src/main/java/org/ros/address/InetAddressFactory.java
+9
-13
9 additions, 13 deletions
...ava/src/main/java/org/ros/address/InetAddressFactory.java
with
9 additions
and
13 deletions
rosjava/src/main/java/org/ros/address/InetAddressFactory.java
+
9
−
13
View file @
52d14497
...
@@ -44,7 +44,13 @@ public class InetAddressFactory {
...
@@ -44,7 +44,13 @@ public class InetAddressFactory {
return
address
.
getAddress
().
length
==
4
;
return
address
.
getAddress
().
length
==
4
;
}
}
private
static
List
<
InetAddress
>
listAllInetAddress
(
Collection
<
NetworkInterface
>
networkInterfaces
)
{
private
static
Collection
<
InetAddress
>
getAllInetAddresses
()
{
List
<
NetworkInterface
>
networkInterfaces
;
try
{
networkInterfaces
=
Collections
.
list
(
NetworkInterface
.
getNetworkInterfaces
());
}
catch
(
SocketException
e
)
{
throw
new
RosRuntimeException
(
e
);
}
List
<
InetAddress
>
inetAddresses
=
Lists
.
newArrayList
();
List
<
InetAddress
>
inetAddresses
=
Lists
.
newArrayList
();
for
(
NetworkInterface
networkInterface
:
networkInterfaces
)
{
for
(
NetworkInterface
networkInterface
:
networkInterfaces
)
{
try
{
try
{
...
@@ -58,16 +64,6 @@ public class InetAddressFactory {
...
@@ -58,16 +64,6 @@ public class InetAddressFactory {
return
inetAddresses
;
return
inetAddresses
;
}
}
private
static
Collection
<
InetAddress
>
getAllInetAddresses
()
{
List
<
NetworkInterface
>
networkInterfaces
;
try
{
networkInterfaces
=
Collections
.
list
(
NetworkInterface
.
getNetworkInterfaces
());
}
catch
(
SocketException
e
)
{
throw
new
RosRuntimeException
(
e
);
}
return
listAllInetAddress
(
networkInterfaces
);
}
private
static
InetAddress
filterInetAddresses
(
Collection
<
InetAddress
>
inetAddresses
)
{
private
static
InetAddress
filterInetAddresses
(
Collection
<
InetAddress
>
inetAddresses
)
{
for
(
InetAddress
address
:
inetAddresses
)
{
for
(
InetAddress
address
:
inetAddresses
)
{
// IPv4 only for now.
// IPv4 only for now.
...
@@ -86,7 +82,7 @@ public class InetAddressFactory {
...
@@ -86,7 +82,7 @@ public class InetAddressFactory {
return
filterInetAddresses
(
Collections
.
list
(
networkInterface
.
getInetAddresses
()));
return
filterInetAddresses
(
Collections
.
list
(
networkInterface
.
getInetAddresses
()));
}
}
private
static
Collection
<
InetAddress
>
getAllInetAddressByName
(
String
host
)
{
private
static
Collection
<
InetAddress
>
getAllInetAddress
es
ByName
(
String
host
)
{
InetAddress
[]
allAddressesByName
;
InetAddress
[]
allAddressesByName
;
try
{
try
{
allAddressesByName
=
org
.
xbill
.
DNS
.
Address
.
getAllByName
(
host
);
allAddressesByName
=
org
.
xbill
.
DNS
.
Address
.
getAllByName
(
host
);
...
@@ -130,7 +126,7 @@ public class InetAddressFactory {
...
@@ -130,7 +126,7 @@ public class InetAddressFactory {
}
catch
(
UnknownHostException
e
)
{
}
catch
(
UnknownHostException
e
)
{
throw
new
RosRuntimeException
(
e
);
throw
new
RosRuntimeException
(
e
);
}
}
Collection
<
InetAddress
>
allAddressesByName
=
getAllInetAddressByName
(
host
);
Collection
<
InetAddress
>
allAddressesByName
=
getAllInetAddress
es
ByName
(
host
);
// First, try to find a non-loopback IPv4 address.
// First, try to find a non-loopback IPv4 address.
for
(
InetAddress
address
:
allAddressesByName
)
{
for
(
InetAddress
address
:
allAddressesByName
)
{
if
(!
address
.
isLoopbackAddress
()
&&
isIpv4
(
address
))
{
if
(!
address
.
isLoopbackAddress
()
&&
isIpv4
(
address
))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment