On Fri, 2002-03-08 at 03:48, Chris Vandomelen wrote: > > For all those who don't follow CVS. The sockets extension modifications > > I listed out a few weeks ago are complete, and will be included in the > > 4.2.0 release. > > I haven't been following CVS, nor have I really paid a lot of attention to > the module. I have received the occasional email about the extension > though, the most recent one being in relation to socket_select().
I understand. Due to the amount of work I have been doing on this module, and the amount of usefulness I get out of this module, I am planning on continuing the maintenance & enhancement work. > In the current CVS, there is a bug in the socket_select() function that > causes it to only return success or failure (RETURN_LONG(retval)), which, > if I'm not mistaken about the rest of the API changes, should be changed > to reflect a true/false value. Yes this is a bug, socket_select() should return false and print an error message. It appears that socket_send() and socket_sendto() suffer from the same bug. Thanks for catching this. A patch to resolve this should be merged. (I should have time later today to correct that) > It also doesn't give you access to the > error which occured (since retval only represents the return of socket(), > but nothing about the actual reason for failure), which is more the bug > than anything. > > The way I would go about fixing it would be to change socket_select() to > return true or false, and if there was an error (as indicated by retval), > store errno somewhere and let socket_last_error()/socket_clear_error() > retrieve that value if there isn't a socket specified. I agree with this approach, however, IMO this is a functionality enhancement (soring a global last error), and probably should wait till 4.3.0. Thoughts anyone? > I've attached a unified diff of the changes to make. The changes are > untested (I need to actually check out a complete version before making > the changes...), but they should compile and work cleanly. (No > guarantees.) Just from an initial view: A problem I notice in this patch is the constant use of SOCKETSLS_FETCH(), a more efficient approach would be to modify the macros in php_sockets.h to retrieve the global structure from TSRMLS(). Also there is a bug in the patch pertaining to the modifications to the socket_last_error() function: arg1 should be initialized to NULL > Chris > > ---- > Thanks for your feedback and patch, -Jason -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php