Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update udp connection info + test #3228

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions cpp/src/Ice/UdpTransceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,6 @@ IceInternal::UdpTransceiver::toString() const
Address localAddr;
fdToLocalAddress(_fd, localAddr);
s << "local address = " << addrToString(localAddr);
if (isAddressValid(_peerAddr))
{
s << "\nremote address = " << addrToString(_peerAddr);
}
}
else
{
Expand Down Expand Up @@ -538,21 +534,16 @@ IceInternal::UdpTransceiver::getInfo(bool incoming, string adapterName, string c
int localPort;
addrToAddressAndPort(localAddr, localAddress, localPort);

string remoteAddress;
int remotePort = 0;
if (isAddressValid(_peerAddr))
{
addrToAddressAndPort(_peerAddr, remoteAddress, remotePort);
}

// Since this info is cached in the Connection object shared by all the clients, we don't store the
// remote address/port of the latest client in this info.
return make_shared<UDPConnectionInfo>(
incoming,
std::move(adapterName),
std::move(connectionId),
std::move(localAddress),
localPort,
std::move(remoteAddress),
remotePort,
"", // remoteAddress
-1, // remotePort
std::move(mcastAddress),
mcastPort,
_rcvSize,
Expand Down
2 changes: 2 additions & 0 deletions cpp/test/Ice/udp/AllTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ allTests(Test::TestHelper* helper)
#endif

cout << "testing udp bi-dir connection... " << flush;
// This feature is only half-implemented. In particular, we maintain a single Connection object on the server side
// that gets updated each time we receive a new request.
obj->ice_getConnection()->setAdapter(adapter);
nRetry = 5;
while (nRetry-- > 0)
Expand Down
7 changes: 5 additions & 2 deletions csharp/src/Ice/Internal/UdpTransceiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -521,14 +521,17 @@ public ConnectionInfo getInfo(bool incoming, string adapterName, string connecti
if (_state == StateNotConnected) // a server connection
{
Debug.Assert(incoming);

// Since this info is cached in the Connection object shared by all the clients, we don't store the
// remote address/port of the latest client in this info.
return new UDPConnectionInfo(
incoming,
adapterName,
connectionId,
Network.endpointAddressToString(localEndpoint),
Network.endpointPort(localEndpoint),
_peerAddr is not null ? Network.endpointAddressToString(_peerAddr) : "",
_peerAddr is not null ? Network.endpointPort(_peerAddr) : -1,
remoteAddress: "",
remotePort: -1,
_mcastAddr is not null ? Network.endpointAddressToString(_mcastAddr) : "",
_mcastAddr is not null ? Network.endpointPort(_mcastAddr) : -1,
_rcvSize,
Expand Down
2 changes: 2 additions & 0 deletions csharp/test/Ice/udp/AllTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ public static async Task allTests(global::Test.TestHelper helper)
Console.Out.WriteLine("ok");

Console.Out.Write("testing udp bi-dir connection... ");
// This feature is only half-implemented. In particular, we maintain a single Connection object on the server
// side that gets updated each time we receive a new request.
Console.Out.Flush();
obj.ice_getConnection().setAdapter(adapter);
nRetry = 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,6 @@ public String toString() {
"local address = "
+ Network.addrToString(
(java.net.InetSocketAddress) socket.getLocalSocketAddress());
if (_peerAddr != null) {
s += "\nremote address = " + Network.addrToString(_peerAddr);
}
} else {
s = Network.fdToString(_fd);
}
Expand Down Expand Up @@ -247,14 +244,17 @@ public ConnectionInfo getInfo(boolean incoming, String adapterName, String conne

if (_state == StateNotConnected) {
assert _incoming;

// Since this info is cached in the Connection object shared by all the clients,
// we don't store the remote address/port of the latest client in this info.
return new UDPConnectionInfo(
incoming,
adapterName,
connectionId,
socket.getLocalAddress().getHostAddress(),
socket.getLocalPort(),
_peerAddr != null ? _peerAddr.getAddress().getHostAddress() : "",
_peerAddr != null ? _peerAddr.getPort() : -1,
"", // remoteAddress
-1, // remotePort
_mcastAddr != null ? _mcastAddr.getAddress().getHostAddress() : "",
_mcastAddr != null ? _mcastAddr.getPort() : -1,
rcvSize,
Expand Down
3 changes: 3 additions & 0 deletions java/test/src/main/java/test/Ice/udp/AllTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ public static void allTests(test.TestHelper helper) {
out.println("ok");

out.print("testing udp bi-dir connection... ");
// This feature is only half-implemented. In particular, we maintain a single
// Connection object on the server side that gets updated each time we receive
// a new request.
out.flush();
obj.ice_getConnection().setAdapter(adapter);
nRetry = 5;
Expand Down
Loading