dji-sdk / Onboard-SDK

DJI Onboard SDK Official Repository
https://github.com/dji-sdk/Onboard-SDK
Other
915 stars 632 forks source link

About lifecycle of MopServer for re-connection #861

Open OpusK opened 2 years ago

OpusK commented 2 years ago

Hi,

This issue is related to #660. The current situation is as follows.

  1. Connect to the pipeline of MopServer and disconnect again.
  2. Then, do not release the memory allocation of MopServer for re-connection
  3. But, when reconnection is attempted, accept failed occurs. ( return code of accept function is 10 )

Unlike my test method, your origin example releases the MopServer's memory allocated after every disconnection and allocates memory again. Does this are your intention? Personally, I think it seems inefficient that the memory release & re-allocation must be repeated for every re-connection.

The code I use is as follows. (recommended in #855)

Thank you!

dji-dev commented 2 years ago

Agent comment from DJI SDK in Zendesk ticket #58899:

尊敬的开发者,感谢您联系DJI 大疆创新 由于github不是我们主要的咨询渠道,您的问题可能跟进不及时。我们建议您通过填写表单( https://djisdksupport.zendesk.com/hc/zh-cn/requests/new )向我们反馈问题。或者您也可以在论坛发帖,与其它开发者交流。论坛链接:https://djisdksupport.zendesk.com/hc/zh-cn/community/topics

Dear developer, thank you for contacting DJI. Since github is not our main consultation channel, your questions may not be followed up in time. We recommend that you fill in the form (https://djisdksupport.zendesk.com/hc/en-us/requests/new) to report problems to us. Or you can post in the forum to communicate with other developers. Forum link: https://djisdksupport.zendesk.com/hc/zh-cn/community/topics

°°°

dji-dev commented 2 years ago

Agent comment from kyle.cai in Zendesk ticket #58899:

Dear developer ,

Thank you for contacting DJI.

This is a problem of code implementation, because there is ID management (dji_mop_server.cpp, MopServer::accept, pipelineMap) in server->accept, this part of code can be updated synchronously.

Thank you for your understanding and support, hope you have a nice day.

Best Regards, DJI SDK Support Team

°°°

choiwooseok commented 2 years ago

Then current solution is delete MopServer when disconnected is right??

I want to check delete vehicle->mopServer and new allocate is OK during flight.

because MopServer instance is in vehicle object

OpusK commented 2 years ago

This is a problem of code implementation, because there is ID management (dji_mop_server.cpp, MopServer::accept, pipelineMap) in server->accept, this part of code can be updated synchronously.

pipelineMap[id] = p; called when server->accept() called. pipelineMap.erase(id); called when server->close() called. right? If so, the above code is written as intended. Or..?

OpusK commented 2 years ago

Any ideas? about @choiwooseok's and mine.

dji-dev commented 2 years ago

Agent comment from kyle.cai in Zendesk ticket #58899:

Dear developer ,

Thank you for contacting DJI.

1、You can refer to the sample to repeat the execution of memory release & re-allocation when you re-connect. 2、If you do not want to repeatedly allocate mopserver resources, you can refer to the above reply and modify the implementation of the code in dji_mop_server.cpp as needed.

Thank you for your understanding and support, hope you have a nice day.

Best Regards, DJI SDK Support Team

°°°