[ 
https://issues.apache.org/jira/browse/FTPSERVER-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12865702#action_12865702
 ] 

David Latorre commented on FTPSERVER-369:
-----------------------------------------

Hello Aniceto,

 After running your code I see that the problem is with our handling of the 
REIN command. I'm fixing the bug but actually you don't need to use REIN at all 
in your code so as a quick fix you may remove these lines:
  try {
                    ftp.logout();
                } catch (Exception ee) {
                }


Other java libraries will send the 'QUIT' command  in the logout method rather 
than REIN (in your provided library, they're sending QUIT when disconnect is 
called). There's no reason to call REIN before QUIT so just calling 
ftp.disconnect is completely ok.

 



> maxLogin is reached immediately 
> --------------------------------
>
>                 Key: FTPSERVER-369
>                 URL: https://issues.apache.org/jira/browse/FTPSERVER-369
>             Project: FtpServer
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.4
>         Environment: Linux or Windows
>            Reporter: Aniceto PĂ©rez y Madrid
>             Fix For: 1.0.5, 1.1.0
>
>         Attachments: ftp4j-1.5.jar, Main.java
>
>
> I've created a simple program loop which open, connect and disconnect. If the 
> max-logins parameter is set to 10, the message "Too many users logged in, 
> user will be disconnected" is issued after 10 loops
> The cause is in DefaultFtpStatistics. In this function
>  
>  public synchronized void setLogout(final FtpIoSession session) {
>         User user = session.getUser();
>         if (user == null) {
>             return;
>         }
>         currLogins.decrementAndGet();
> session.getUser() always returns null, so never currLogins.decrementAndGet() 
> is called. My workaround is to put that statement before testing user null 
> state. 
> Why      session.getUser()  return null is out of my knowledge.
>   

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

Reply via email to