[Nut-upsdev] MGE NMC and NutShutdownModule (and other stuff)

Arjen de Korte nut+devel at de-korte.org
Thu Nov 5 18:55:41 UTC 2009


Citeren Marco Chiappero <marco op absence.it>:

> In the meanwhile I'm having a really quick look at the code
> and there is a small issue in the upsdrv_updateinfo:
> the alarm parsing code is fine as long as you have a single message  
> at time in the socket buffer "buf", but if the NMC sends burst of  
> messages the ne_xml_parse function will read only the first one  
> (because after that sees more objects without a parent.

This is irrelevant. We could even not parse the alarm messages at all,  
since we also parse the summary and get_object pages. Everything that  
can be sent through an alarm message, can also be polled through these  
two pages.

> BTW it's the same reason why we need to parse differently the  
> subscription reply, there is no root element). Maybe my code was a  
> little bit obscure about it.

No, it was very clear. But the NMC sends out alarms separately. What's  
different here, is that the arrival of an alarm immediately triggers  
reading it. We don't hang around in the main driver body until the  
pollinterval elapses, but break from that.

> And the netxml_get_page(subdriver->summary) should be called before  
> parsing alarms (let's suppose we used the test button, the  
> BelowCapacity flag is read, set and soon after cleared).

There is always a couple of seconds between these events. This is more  
than enough for the driver to read the alarm messages. The response  
time is typically well below one second (note the use of 'extrafd'  
which will immediately trigger reading from the socket if an alarm  
message arrived). For the same reason it is extremely unlikely that a  
new alarm message arrives before the previous one has been read.

Best regards, Arjen
-- 
Please keep list traffic on the list




More information about the Nut-upsdev mailing list