nasa / fprime

F´ - A flight software and embedded systems framework
https://fprime.jpl.nasa.gov
Apache License 2.0
9.95k stars 1.28k forks source link

Add Open Port Request on Sending Side of IpSocket #2683

Open csmith608 opened 2 months ago

csmith608 commented 2 months ago
Related Issue(s) #2553
Has Unit Tests (y/n) y
Documentation Included (y/n) n

Change Description

Update IpSocket to check socket state on sending side and open socket if necessary

Rationale

This fixes a bug encountered while using IpSocket. The server would close the TCP connection and then the client would try to send and fail because previously IpSocket would only re-open a TCP connection when it received over the socket.

Testing/Review Recommendations

In my project's version of fprime we diverged at fprime 3.0. I added implementations for the close() port in the TcpClient, TcpServer, and Udp as well as unit tests. This change also fixed the issue we were seeing with sending data, but the socket not being there. This does not include the unit tests or implementations for close() in the ByteStreamDriverModel because I wanted to at least get this part of the change in. I'll work on adding them. I also ended up commenting out line 85 of Drv/Ip/SocketReadTask.cpp because when I was running other testing without the TCP server, I was being spammed with that logger message.

Future Work

Adding implementations for close() to TcpClient, TcpServer, and Udp as well as unit tests.

(Pipeline failed on "spammed" but I stand behind my spelling, but perhaps not that comment)

LeStarch commented 2 months ago

Looks like it passed CI. We'll need to correct spelling. Your spelling is right, so we need to add the word to the expect list.

LeStarch commented 2 months ago

The list is at: .github/actions/spelling/expect.txt. Just place "spammed" in there is mostly alphabetical order. I can help this afternoon, but the above shows you how to should you get to it sooner.

LeStarch commented 2 months ago

Fixed the spelling issue. Will review now.

csmith608 commented 1 week ago

@LeStarch I added a unit test to TcpClient and TcpServer to show the socket auto opening, so I think this should be okay to merge (if it passes the checks).