[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[JDEV] Minor 'bug'let ?



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
begin:vcard 
n:van Gulik;Dirk-Willem
tel;fax:+39 0332 78 9185
tel;work:+39 0332 78 9549
x-mozilla-html:FALSE
url:http://me-www.jrc.it/~dirkx
org:Joint Research Center of the European Commission;Software Technology and Applications, Institute for Systems, Informatics and Security
version:2.1
email;internet:Dirk.vanGulik@jrc.it
title:Mr
adr;quoted-printable:;;TP 270 - ISIS/STA=0D=0AJoint Resarch Center;Ispra;VA;21020;Italy
x-mozilla-cpt:;0
fn:Dirk-Willem van Gulik
end:vcard