Question about otSrpClientSetHostName() #8181
-
I have a question concerning this code in SrpClient::Process(): openthread/src/cli/cli_srp_client.cpp Lines 134 to 149 in 24d633d In the second part of this code, why do we have to retrieve a pointer to the persisted butter, memcpy the data to it and then call otSrpClientSetHostName() ? Thanks for your information |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The SRP Client only maintains a pointer to the host name provided by the caller. As a result, the caller must maintain the buffer while the host name is in use. As the comment mentions, the first call to openthread/src/cli/cli_srp_client.cpp Lines 140 to 144 in 0756d1e However, the first call will set the pointer to a buffer that the client cannot maintain (i.e. openthread/src/cli/cli_srp_client.cpp Line 146 in 0756d1e The openthread/src/cli/cli_srp_client.cpp Line 149 in 0756d1e |
Beta Was this translation helpful? Give feedback.
The SRP Client only maintains a pointer to the host name provided by the caller. As a result, the caller must maintain the buffer while the host name is in use. As the comment mentions, the first call to
otSrpClientSetHostName()
simply checks whether we can set the host name successfully.openthread/src/cli/cli_srp_client.cpp
Lines 140 to 144 in 0756d1e
However, the first call will set the pointer…