[Live-devel] [PATCH] GroupsockHelper: include errno in error message in case of send error
    Stas Tsymbalov 
    tsymbalov at trueconf.ru
       
    Fri May 29 01:37:40 PDT 2015
    
    
  
> This is unnecessary, because the call to “socketErr()” in the original code already calls “UsageEnvironment::setResultErrMsg()”, which in turn is implemented by calling “strerror()” on the ‘errno’ code.
Except on Windows strerror() doesn't work with winsocket error codes (returned by WSAGetLastError()) instead FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGetLastError(), ...) should be used.
I guess it would be better (than my solution) to change BasicUsageEnvironment0::setResultErrMsg() to account for that (would you be interested in a patch?)
But I have 2 more minor points:
  1. Right now messages for socket errors look like this: "writeSocket(42), sendTo() error: wrote -1 bytes instead of 4242:", this looks odd.
  2. I my opinion error codes are far more useful than textual messages when grep'ing logs, so it would be nice to have error code as a number in the message.
-- 
Stas Tsymbalov
TrueConf LLC
http://trueconf.com/
    
    
More information about the live-devel
mailing list