fix 385838 don't do a disk sync after each pop3 header in partial header download fetch
authorhyc@symas.com
Sun, 19 Oct 2008 15:55:41 -0700
changeset 639 dbf99684062a72577c86eba387dc15c6793108ec
parent 638 13e0d281604738690b5f9860a0424d71ad4009c1
child 640 9b9d8827fef9185010a7fed904ebc3f3804c1ed8
push id570
push userbienvenu@nventure.com
push dateSun, 19 Oct 2008 22:55:47 +0000
treeherdercomm-central@dbf99684062a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs385838
fix 385838 don't do a disk sync after each pop3 header in partial header download fetch
mailnews/local/src/nsPop3Sink.cpp
--- a/mailnews/local/src/nsPop3Sink.cpp
+++ b/mailnews/local/src/nsPop3Sink.cpp
@@ -779,18 +779,21 @@ nsPop3Sink::IncorporateComplete(nsIMsgWi
     PRUint32 msgKey;
     m_newMailParser->GetEnvelopePos(&msgKey);
     m_messageUri.SetLength(0);
     nsBuildLocalMessageURI(m_baseMessageUri.get(), msgKey, m_messageUri);
   }
 
   nsresult rv = WriteLineToMailbox(MSG_LINEBREAK);
   if (NS_FAILED(rv)) return rv;
+  PRBool leaveOnServer = PR_FALSE;
+  m_popServer->GetLeaveMessagesOnServer(&leaveOnServer);
   // aSize is only set for partial messages. Skip the flush for partials.
-  if (!aSize)
+  // Only flush if this is a full message and we didn't leave a copy on the server.
+  if (!aSize && !leaveOnServer)
     rv = m_outFileStream->Flush();   //to make sure the message is written to the disk
   if (NS_FAILED(rv)) return rv;
   NS_ASSERTION(m_newMailParser, "could not get m_newMailParser");
   if (m_newMailParser)
   {
     // PublishMsgHdr clears m_newMsgHdr, so we need a comptr to
     // hold onto it.
     nsCOMPtr <nsIMsgDBHdr> hdr = m_newMailParser->m_newMsgHdr;