Print

Print


Here are the changes to XrdClient. Many of the fixes are for abuse of  
casts and const. They are well worth fixing. The important errors are  
in XrdClientSock.cc. The test for read and write errors is not
     n = read(...);
     if (!n) { error }

it is (in your case)
     if (n <= 0) { error }

The way you had it, read was returning -1 and you were not catching  
it and thus making extra trips through the loops. The problem is that  
when there is a read failure, it is often because Disconnect has been  
called after the poll completed "successfully" and a read on fd = -1  
is performed. Likewise for writes.

In one place I put the comment "HELP". You probably need to review  
the change I made there and see if you want a different response to  
the error condition. I couldn't make sense of the protocol, but I  
guessed that the error was catastrophic.

One big request I have is that you please please please change the name

     EnvGetLong to EnvGetInt.

Int and long are NOT the same (read Henry Spencer's "Ten Commandments  
of C Programming" and obey them), and your methods definitely work  
with ints. Oddly enough, the corresponding put method is called  
EnvPutInt. The code will be far less misleading if the get method  
matches the put method.

If there are changes that I have sent in that you can't understand, I  
am only too happy to explain them.

The patch can be found at

     http://www.lepp.cornell.edu/~gregor/XrdClientPatch.tar

--
Gregory J. Sharp                   email: [log in to unmask]
Wilson Synchrotron Laboratory      url: http://www.lepp.cornell.edu/ 
~gregor
Cornell University                 ph:  +1 607 255 4882
Ithaca, NY 14853                   fax: +1 607 255 8062