aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2015-04-01 23:35:46 -0700
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2015-04-02 23:50:04 -0700
commitcbee27cd693ceed2738d88a39e71d7a599b9e28f (patch)
tree2e498b2fe2f60532fc866bc5f96ce4ef65c47c88
parent0d010747d431b612eac5959d9db832dcfdaf46b1 (diff)
disconnection operation, disconnect when pipeline is enabled
-rw-r--r--src/async/smtp/MCSMTPAsyncSession.cpp7
-rw-r--r--src/async/smtp/MCSMTPAsyncSession.h2
-rw-r--r--src/core/smtp/MCSMTPSession.cpp1
3 files changed, 10 insertions, 0 deletions
diff --git a/src/async/smtp/MCSMTPAsyncSession.cpp b/src/async/smtp/MCSMTPAsyncSession.cpp
index 9fe55e2e..d2f645da 100644
--- a/src/async/smtp/MCSMTPAsyncSession.cpp
+++ b/src/async/smtp/MCSMTPAsyncSession.cpp
@@ -255,6 +255,13 @@ SMTPOperation * SMTPAsyncSession::noopOperation()
return (SMTPOperation *) op->autorelease();
}
+SMTPOperation * SMTPAsyncSession::disconnectOperation()
+{
+ SMTPDisconnectOperation * op = new SMTPDisconnectOperation();
+ op->setSession(this);
+ return (SMTPOperation *) op->autorelease();
+}
+
void SMTPAsyncSession::setConnectionLogger(ConnectionLogger * logger)
{
pthread_mutex_lock(&mConnectionLoggerLock);
diff --git a/src/async/smtp/MCSMTPAsyncSession.h b/src/async/smtp/MCSMTPAsyncSession.h
index 38da3717..90849797 100644
--- a/src/async/smtp/MCSMTPAsyncSession.h
+++ b/src/async/smtp/MCSMTPAsyncSession.h
@@ -72,6 +72,8 @@ namespace mailcore {
virtual SMTPOperation * noopOperation();
+ virtual SMTPOperation * disconnectOperation();
+
public: // private
virtual void runOperation(SMTPOperation * operation);
virtual SMTPSession * session();
diff --git a/src/core/smtp/MCSMTPSession.cpp b/src/core/smtp/MCSMTPSession.cpp
index eab05730..cb9b02cb 100644
--- a/src/core/smtp/MCSMTPSession.cpp
+++ b/src/core/smtp/MCSMTPSession.cpp
@@ -626,6 +626,7 @@ void SMTPSession::sendMessage(Address * from, Array * recipients, Data * message
r = mailesmtp_send_quit(mSmtp, MCUTF8(from->mailbox()), 0, NULL,
address_list,
messageData->bytes(), messageData->length());
+ mShouldDisconnect = true;
}
else {
r = mailesmtp_send(mSmtp, MCUTF8(from->mailbox()), 0, NULL,