Antwort: Re: [Nut-upsuser] "no longer stale" when disconnected
with 2.0.5
Arjen de Korte
nut+users at de-korte.org
Mon Jan 29 15:23:10 CET 2007
> here the output of "upsd -DDDDD" when starting "upsc apc at localhost
> ups.status" (and stopping after 20-30 sec with an ctrl+c)
Ah, you have a problem with 'upsc' rather than with 'upscmd' like you
stated before. That changes things.
> Connection from 127.0.0.1
> acl_check: localhost: match 1
> ACL [localhost] matches, action=1
> write: [destfd=6] [len=24] [VAR apc ups.status "OL"]
This looks (almost) good, apparently upsd got a request to send the value
of 'ups.status' and decoded this properly. It sends [VAR apc ups.status
"OL"] in return, which looks good at first glance. But it isn't... ;-)
Yesterday I committed a change to upsd.c to remove the trailing '\n' in
debug mode, since that would break the line with 'write: ...' on it, which
looked rather ugly. Bummer, since the rtrim() function that I used will
strip it from the answer sent to the connecting client also, the answer
will now be shorter than expected and miss the trailing '\n'
(server/upsd.c):
int sendback(ctype *client, const char *fmt, ...)
[...]
upsdebugx(2, "write: [destfd=%d] [len=%d] [%s]",
client->fd, len, rtrim(ans, '\n'));
if (client->ssl)
res = ssl_write(client, ans, len);
else
res = write(client->fd, ans, len);
The solution is to move the line with upsdebugx to after the lines writing
this to the client. I will commit this fix later today. This is an
unrelated problem from the staleness warnings though.
Best regards, Arjen
More information about the Nut-upsuser
mailing list