[jboss-jira] [JBoss JIRA] Created: (JGRP-883) Use of Math.min In GossipRouter's Socket Linger Code Causes Unexpected Results

Jimmy Wilson (JIRA) jira-events at lists.jboss.org
Tue Jan 6 15:57:04 EST 2009


Use of Math.min In GossipRouter's Socket Linger Code Causes Unexpected Results
------------------------------------------------------------------------------

                 Key: JGRP-883
                 URL: https://jira.jboss.org/jira/browse/JGRP-883
             Project: JGroups
          Issue Type: Bug
    Affects Versions: 2.7, 2.6.7, 2.5.2, 2.4.4
            Reporter: Jimmy Wilson
            Assignee: Jimmy Wilson
             Fix For: 2.4.5, 2.6.8, 2.8


>From 2.6.7 Gossip Router Code:

    /** Time (in millis) for setting SO_LINGER on sockets returned from accept(). 0 means don't set SO_LINGER */
    private long linger_timeout=2000L;

...snip...

    if(linger_timeout > 0) {
        int linger=Math.min(1, (int)(linger_timeout / 1000));
        sock.setSoLinger(true, linger);
    }

This means that the socket linger timeout will always be 1 regardless of what you set exception when a millisecond value of less than one second is specified which isn't valid for a socket linger timeout anyway.  Math.max should likely be used instead.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list