[jboss-jira] [JBoss JIRA] (JGRP-1435) Out-by-one errors in port_range handling

Bela Ban (JIRA) jira-events at lists.jboss.org
Wed Mar 7 02:56:36 EST 2012


     [ https://issues.jboss.org/browse/JGRP-1435?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bela Ban resolved JGRP-1435.
----------------------------

    Resolution: Done

    
> Out-by-one errors in port_range handling
> ----------------------------------------
>
>                 Key: JGRP-1435
>                 URL: https://issues.jboss.org/browse/JGRP-1435
>             Project: JGroups
>          Issue Type: Bug
>    Affects Versions: 3.0.6, 3.1
>            Reporter: David Hotham
>            Assignee: Bela Ban
>            Priority: Minor
>             Fix For: 3.1
>
>
> Various mismatches between documentation and code for port_range handling.  I don't know which you prefer to fix.  It would also be desirable if the behaviour was consistent between different protocols.
> BPING says
>     @Property(description="Sends discovery packets to ports 8555 to (8555+port_range)")
> but the code goes
>         for(int i=bind_port; i < bind_port+port_range; i++) {
> so actually packets go to 8555+port_range-1, and value 0 is meaningless.  Probably that should be a <= there (with corresponding fixes required in a couple of other places in the file).
> FD_SOCK says
>     @Property(description="Number of ports to probe for start_port and client_bind_port")
> but in setupPingSocket(), the code goes
>                         if(num_bind_attempts++ > port_range) {
> Since this is a post-increment, we'll actually try not one but two more ports than promised.  Eg if port_range is zero, we'll try both client_bind_port and client_bind_port+1.  Probably you want to change this to a pre-increment, and also change the documentation to describe what actually happens.
> I believe that TCPPING and TP both behave as advertised, ie:
>     @Property(description="The range of valid ports, from bind_port to end_port. 0 only binds to bind_port and fails if taken")
> ... and my suggestion would be that this is what you really want in all cases.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list