diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | lib/net/smtp.rb | 15 |
2 files changed, 18 insertions, 4 deletions
@@ -1,3 +1,10 @@ +Sat Jul 12 04:17:40 2014 KOSAKI Motohiro <kosaki.motohiro@gmail.com> + + * lib/net/smtp.rb (Net::SMTP#data): enable buffering while + 'data' send for optimizing Net::SMTP#send_message. + [ruby-dev:48329] [misc #9981] + patch by Masahiro Tomita. + Sat Jul 12 01:13:45 2014 Naohisa Goto <ngotogenome@gmail.com> * test/ruby/envutil.rb (assert_no_memory_leak): On Solaris 9 or later, diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index 5fd4f8e5c5..64e536a12a 100644 --- a/lib/net/smtp.rb +++ b/lib/net/smtp.rb @@ -901,10 +901,17 @@ module Net end res = critical { check_continue get_response('DATA') - if msgstr - @socket.write_message msgstr - else - @socket.write_message_by_block(&block) + socket_sync_bak = @socket.io.sync + begin + @socket.io.sync = false + if msgstr + @socket.write_message msgstr + else + @socket.write_message_by_block(&block) + end + ensure + @socket.io.flush + @socket.io.sync = socket_sync_bak end recv_response() } |