summaryrefslogtreecommitdiff
path: root/lib/net/smtp.rb
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-11 19:22:19 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-11 19:22:19 +0000
commit00eb72039495a0ae2cdae55f1d660a2ab0f26cb9 (patch)
tree4d081d10df017183ea1f29ebcf1976b1201fc9c8 /lib/net/smtp.rb
parentf11c30e8015cbd10c91b19b20fac9102992ac428 (diff)
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/smtp.rb')
-rw-r--r--lib/net/smtp.rb15
1 files changed, 11 insertions, 4 deletions
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()
}