-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
modified: Drv/TcpClient/TcpClientComponentImpl.cpp #2759
Conversation
@menaman123 sorry, I didn't catch your question. I do like that you have defaulted this, but I'd move the allocation size to the Note: We should do separate PRs for TcpServer and UDP too (once this one is approved)! |
@LeStarch Should i modify the getBuffer such that it returns the member allocate(0, m_allocation_size)? |
@LeStarch I changed the header file, I was wondering should the default buffer size be hardcoded as 1024 or a variable called DEFAULT_BUFFER_SIZE should be created instead? |
One last change: use I am ok with the hardcoded 1024. It is a default after all, and easily changed. Thanks for this change, we've needed it for some time! |
You missed the member variable change to Your code looks good. Normally, we'd prefix all member variables with Once CI passes, we'll merge this! |
Sweet thank you so much for the insight and teaching me the way!! @LeStarch |
The issue with CI is this: F´ is in the process of transitioning from fixed-width types (e.g. U32) to project configurable types (e.g. FwSizeType). In this case Here is how to fix this. Add a cast to the allocation call to convert types:
Add this check to the
This check ensures that the configured buffer size fits within the limit of the old structure. We do this in You may need to include these headers (if not already done so):
|
@@ -126,6 +128,9 @@ | |||
Drv::SendStatus send_handler(const NATIVE_INT_TYPE portNum, Fw::Buffer& fwBuffer); | |||
|
|||
Drv::TcpClientSocket m_socket; //!< Socket implementation | |||
|
|||
// Member variable to store the buffer size | |||
FwSizeType m_allocation_size; |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
@@ -28,7 +29,12 @@ | |||
SocketIpStatus TcpClientComponentImpl::configure(const char* hostname, | |||
const U16 port, | |||
const U32 send_timeout_seconds, | |||
const U32 send_timeout_microseconds) { | |||
const U32 send_timeout_microseconds, | |||
FwSizeType buffer_size) { |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
Change Description
Changed the getBuffer function to have a tunable size. There is a default size of 1024 so that it does not break any existing code.
Rationale
This removes the need of having to fork off of the fprime repo or autopatch everytime.
Testing/Review Recommendations
There is no unit tests to see if it'll break anything. Unsure where to begin to test to see.
Future Work