-
- Downloads
Bring some sanity to sendfilesocket()
Not that there's any need to, it appears that it was written for the web server, then discarded for that purpose and now is only called from the JS Socket.sendfile() method, which always passes NULL and 0 for the last two parameters, and has a copy/pasted implementation for TLS sockets. The only consumer of that in the tree appears to be gopher_service.js. It was apparently to use as a wrapper for the high-performance FreeBSD sendfile(), but that code behaved differently than all the other platforms, and was disabled (behind USE_SENDFILE, which isn't defined anywhere). This should really just be folded into either js_socket_sendfilesocket() or js_sendfile() with the extra knobs broken off and all the TODO comments I'm adding here addressed. Though, since Socket.sendfile() returns a bool where true indicates that either the size of the file at the start of the function was sent, or an EOF was reached, and false indicates that "something else happened", some of the TODO comments don't really need to be addressed. Basically, this is a crap function and it's only used by an even more crap JS wrapper, it should be tucked into a backward compatibility function, removed from the JSDocs, and forgotten about. If Coverity keeps complaining about this, I'll wait until after the next release and drag this out back and shoot it. Otherwise, I'll just forget it ever existed.
Please register or sign in to comment