You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Ankur (JIRA)" <ji...@apache.org> on 2008/05/13 10:36:57 UTC

[jira] Created: (FTPSERVER-134) MinaListener should correctly set the port after bind() in start()

MinaListener should correctly set the port after bind() in start()
------------------------------------------------------------------

                 Key: FTPSERVER-134
                 URL: https://issues.apache.org/jira/browse/FTPSERVER-134
             Project: FtpServer
          Issue Type: Bug
            Reporter: Ankur


In the start() method, once the acceptor.bind(address) call is executed the listener might end up listening on a port different than the one supplied. This is true for the case where user specifies 0 as the port setting to enable the OS to pick a free port.

When embedding FTPServer in an application there is no way of finding out what port the listener ended up listening on.

Following is a simple suggested fix and should be added at the end of the MinaListener.start() method after the acceptor.bind(address) call.

setPort(acceptor.getLocalAddress().getPort());

This will allow application code to correctly retrieve the port where the listener ended up listening.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (FTPSERVER-134) MinaListener should correctly set the port after bind() in start()

Posted by "Niklas Gustavsson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FTPSERVER-134?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niklas Gustavsson closed FTPSERVER-134.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.0-M2
         Assignee: Niklas Gustavsson

Fixed!

commit -m "Make sure getPort() actually returns the port the listener is really bound to (FTPSERVER-134)" /home/niklas/workspaces/apache/ftpserver/core/src/main/java/org/apache/ftpserver/listener/mina/MinaListener.java /home/niklas/workspaces/apache/ftpserver/core/src/test/java/org/apache/ftpserver/clienttests/ClientTestTemplate.java /home/niklas/workspaces/apache/ftpserver/core/src/test/java/org/apache/ftpserver/clienttests/ConnectTest.java
    Sending        /home/niklas/workspaces/apache/ftpserver/core/src/main/java/org/apache/ftpserver/listener/mina/MinaListener.java
    Sending        /home/niklas/workspaces/apache/ftpserver/core/src/test/java/org/apache/ftpserver/clienttests/ClientTestTemplate.java
    Adding         /home/niklas/workspaces/apache/ftpserver/core/src/test/java/org/apache/ftpserver/clienttests/ConnectTest.java
    Transmitting file data ...
    Committed revision 655816.

> MinaListener should correctly set the port after bind() in start()
> ------------------------------------------------------------------
>
>                 Key: FTPSERVER-134
>                 URL: https://issues.apache.org/jira/browse/FTPSERVER-134
>             Project: FtpServer
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0
>         Environment: Linux
>            Reporter: Ankur
>            Assignee: Niklas Gustavsson
>             Fix For: 1.0-M2
>
>
> In the start() method, once the acceptor.bind(address) call is executed the listener might end up listening on a port different than the one supplied. This is true for the case where user specifies 0 as the port setting to enable the OS to pick a free port.
> When embedding FTPServer in an application there is no way of finding out what port the listener ended up listening on.
> Following is a simple suggested fix and should be added at the end of the MinaListener.start() method after the acceptor.bind(address) call.
> setPort(acceptor.getLocalAddress().getPort());
> This will allow application code to correctly retrieve the port where the listener ended up listening.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FTPSERVER-134) MinaListener should correctly set the port after bind() in start()

Posted by "Niklas Gustavsson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FTPSERVER-134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12596365#action_12596365 ] 

Niklas Gustavsson commented on FTPSERVER-134:
---------------------------------------------

Well defined requests usually get quick fixes :-)

> MinaListener should correctly set the port after bind() in start()
> ------------------------------------------------------------------
>
>                 Key: FTPSERVER-134
>                 URL: https://issues.apache.org/jira/browse/FTPSERVER-134
>             Project: FtpServer
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0
>         Environment: Linux
>            Reporter: Ankur
>            Assignee: Niklas Gustavsson
>             Fix For: 1.0-M2
>
>
> In the start() method, once the acceptor.bind(address) call is executed the listener might end up listening on a port different than the one supplied. This is true for the case where user specifies 0 as the port setting to enable the OS to pick a free port.
> When embedding FTPServer in an application there is no way of finding out what port the listener ended up listening on.
> Following is a simple suggested fix and should be added at the end of the MinaListener.start() method after the acceptor.bind(address) call.
> setPort(acceptor.getLocalAddress().getPort());
> This will allow application code to correctly retrieve the port where the listener ended up listening.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FTPSERVER-134) MinaListener should correctly set the port after bind() in start()

Posted by "Ankur (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FTPSERVER-134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12596363#action_12596363 ] 

Ankur commented on FTPSERVER-134:
---------------------------------

That was quick, Thanks :-)

> MinaListener should correctly set the port after bind() in start()
> ------------------------------------------------------------------
>
>                 Key: FTPSERVER-134
>                 URL: https://issues.apache.org/jira/browse/FTPSERVER-134
>             Project: FtpServer
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0
>         Environment: Linux
>            Reporter: Ankur
>            Assignee: Niklas Gustavsson
>             Fix For: 1.0-M2
>
>
> In the start() method, once the acceptor.bind(address) call is executed the listener might end up listening on a port different than the one supplied. This is true for the case where user specifies 0 as the port setting to enable the OS to pick a free port.
> When embedding FTPServer in an application there is no way of finding out what port the listener ended up listening on.
> Following is a simple suggested fix and should be added at the end of the MinaListener.start() method after the acceptor.bind(address) call.
> setPort(acceptor.getLocalAddress().getPort());
> This will allow application code to correctly retrieve the port where the listener ended up listening.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FTPSERVER-134) MinaListener should correctly set the port after bind() in start()

Posted by "Ankur (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FTPSERVER-134?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ankur updated FTPSERVER-134:
----------------------------

          Component/s: Core
          Environment: Linux
    Affects Version/s: 1.0

> MinaListener should correctly set the port after bind() in start()
> ------------------------------------------------------------------
>
>                 Key: FTPSERVER-134
>                 URL: https://issues.apache.org/jira/browse/FTPSERVER-134
>             Project: FtpServer
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0
>         Environment: Linux
>            Reporter: Ankur
>
> In the start() method, once the acceptor.bind(address) call is executed the listener might end up listening on a port different than the one supplied. This is true for the case where user specifies 0 as the port setting to enable the OS to pick a free port.
> When embedding FTPServer in an application there is no way of finding out what port the listener ended up listening on.
> Following is a simple suggested fix and should be added at the end of the MinaListener.start() method after the acceptor.bind(address) call.
> setPort(acceptor.getLocalAddress().getPort());
> This will allow application code to correctly retrieve the port where the listener ended up listening.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.