[JDEV] Minor 'bug'let ?

Dirk-Willem van Gulik dirk.vangulik at jrc.it
Tue Jan 5 13:46:16 CST 1999


Though I admit that I do not completely understand the code; a minor
buglet showed up on FreeBSD (if you optimize and non-null your structs).

Sorry for the structure, but I could not find a CVS to diff against.

In 	.../common/io.c

+               read_fd_set = active_fd_set;
        	/* first time through we initialize the IO routine */
                if(!first)
                {
                        DBUG("IO: waiting ","")
-                	read_fd_set = active_fd_set;
                        h_err(select(FD_SETSIZE, &read_fd_set,
&write_fd_set, NULL, NULL),"select");

                        DBUG("IO: select returned","")
                        FD_ZERO(&active_fd_set);
                } else {

Otherwise if the read_fd_set happens to contani cruft, the accept
further down is triggered tooo easily.

Secondly, given that the active_fd_set is (re)build each time; it
is worthwhile to keep a maxfd; rather than FD_SETSIZE; at least
on FreeBSD that makes a speed difference.

Thirdly setting TCP_NODELAY and alllowing for port REUSE might be
nice. 
        if( (setsockopt(c->id,SOL_SOCKET,SO_REUSEADDR,(const char
*)&one,sizeof(one))) <0)
        if( (setsockopt(c->id,IPPROTO_TCP,TCP_NODELAY,(const void
*)&one,sizeof(one))) <0) 

DW
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Dirk.VanGulik.vcf
Type: text/x-vcard
Size: 477 bytes
Desc: Card for Dirk-Willem van Gulik
URL: <http://mail.jabber.org/pipermail/jdev/attachments/19990105/dbd1e56c/attachment-0002.vcf>


More information about the JDev mailing list