package org.subethamail.smtp.command;

import java.io.IOException;

import org.subethamail.smtp.server.BaseCommand;
import org.subethamail.smtp.server.ConnectionContext;

/**
 * @author Ian McFarland &lt;ian@neo.com&gt;
 * @author Jon Stevens
 */
public class QuitCommand extends BaseCommand
{
	public QuitCommand()
	{
		super("QUIT", "Exit the SMTP session.");
	}

	@Override
	public void execute(String commandString, ConnectionContext context) throws IOException
	{
		context.getSession().quit();
		context.sendResponse("221 Bye");		
	}
}

package org.subethamail.smtp.command;

import java.io.IOException;

import org.subethamail.smtp.server.BaseCommand;
import org.subethamail.smtp.server.ConnectionContext;

/**
 * @author Ian McFarland &lt;ian@neo.com&gt;
 * @author Jon Stevens
 */
public class QuitCommand extends BaseCommand
{
	public QuitCommand()
	{
		super("QUIT", "Exit the SMTP session.");
	}

	@Override
	public void execute(String commandString, ConnectionContext context) throws IOException
	{
		context.sendResponse("221 Bye");
		context.getSession().quit();
	}
}

--- 
+++ 
@@ -19,7 +19,7 @@
 	@Override
 	public void execute(String commandString, ConnectionContext context) throws IOException
 	{
-		context.sendResponse("221 Bye");
 		context.getSession().quit();
+		context.sendResponse("221 Bye");		
 	}
 }
Fix to ensure session is closed on QUIT command response

git-svn-id: 22ec8cfea0672d04b2346d96717164b900bedbad@212 d4f6eda6-38e6-11de-8fef-1f5ae417a2df
