nsg-ethz / autopower

A software suite to conveniently collect, gather, and display power measurement from networking hardware.
MIT License
2 stars 1 forks source link

Make client requests non blocking #24

Open UsualSpec opened 1 week ago

UsualSpec commented 1 week ago

https://github.com/nsg-ethz/autopower/blob/1911af784f3ebd97050e28a316931f3fd56d8f28/client/client.cc#L631

is executed in one thread only. To allow responsiveness, we should rewrite the code such that we execute management functionality in a separate/separate threads. Then the client remains responsive for new commands from the server and can already start them if possible. This could fix #23 potentially.

Suggestion:

  1. If a new sRequest arrives, put it into a commands queue
  2. In another thread consume the queue and issue the respective function in a separate thread.
  3. Send response to server
romain-jacob commented 1 week ago

Somewhat related: why do we send a request to the client in order to get the IP? Why not simply save the IP in the database when the client registers to the server? Sounds like it would be a lot simpler, no?

And if the IP changes, the client would anyway register again to the server I suppose, since changing IP address (almost always) implies we lost network connectivity. Or am I missing something?