Skip to content

Conversation

@mbenson1
Copy link
Collaborator

No description provided.

@mbenson1 mbenson1 requested a review from Copilot August 18, 2025 16:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new UdpToTcpProxy class that implements a network proxy service, forwarding UDP packets to connected TCP clients. This appears to be adding video streaming proxy functionality to the Yamcs system.

  • Implements a UDP-to-TCP proxy that listens for UDP packets and forwards them to multiple TCP clients
  • Extends AbstractThreadedTcDataLink for integration with the Yamcs framework
  • Provides system parameter monitoring for UDP and TCP port configurations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

}
tcpClients.remove(client);
}
}
Copy link

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing an element from a synchronized collection while iterating over it can cause a ConcurrentModificationException. Consider using an iterator with remove() or collecting clients to remove in a separate list first.

Suggested change
}
clientsToRemove.add(client);
}
}
tcpClients.removeAll(clientsToRemove);

Copilot uses AI. Check for mistakes.
try {
while (!clientSocket.isClosed()) {
if (clientSocket.getInputStream().read() == -1) {
break;
Copy link

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The read() call blocks indefinitely and could prevent proper cleanup. Consider using a timeout or non-blocking approach to detect client disconnections more efficiently.

Suggested change
break;
clientSocket.setSoTimeout(1000); // Set read timeout to 1 second
while (!clientSocket.isClosed()) {
try {
if (clientSocket.getInputStream().read() == -1) {
break;
}
} catch (java.net.SocketTimeoutException e) {
// Timeout occurred, check again if socket is closed
continue;

Copilot uses AI. Check for mistakes.
import org.yamcs.yarch.TupleDefinition;

// public class UdpToTcpProxy extends AbstractThreadedTcDataLink implements SystemParametersProducer
// {
Copy link

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented-out code. If this interface implementation is planned for the future, consider adding a TODO comment with context instead.

Suggested change
// {
// TODO: If implementing SystemParametersProducer is planned, add interface and implementation here.

Copilot uses AI. Check for mistakes.
}
}

// @Override
Copy link

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Large blocks of commented-out code (lines 252-310) should be removed to improve readability. If these methods need to be implemented later, consider adding proper TODO comments instead.

Copilot uses AI. Check for mistakes.

@Override
protected void startUp() throws Exception {
// TODO Auto-generated method stub
Copy link

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The startUp() method is empty with only a TODO comment. Either implement the required functionality or remove the comment if no implementation is needed.

Suggested change
// TODO Auto-generated method stub

Copilot uses AI. Check for mistakes.

@Override
protected void shutDown() throws Exception {
// TODO Auto-generated method stub
Copy link

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shutDown() method is empty with only a TODO comment. Either implement the required cleanup functionality or remove the comment if no implementation is needed.

Suggested change
// TODO Auto-generated method stub
super.shutDown();

Copilot uses AI. Check for mistakes.
/* Update PV telemetry */
TupleDefinition tdef = gftdef.copy();
// pushTuple(tdef, cols);

Copy link

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented-out code for telemetry update should be either implemented or removed. The variables 'tdef' and undefined 'cols' suggest incomplete implementation.

Suggested change

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants