summaryrefslogtreecommitdiff
path: root/lib/rbot/ircsocket.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbot/ircsocket.rb')
-rw-r--r--lib/rbot/ircsocket.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/rbot/ircsocket.rb b/lib/rbot/ircsocket.rb
index 2e6ff452..4ac98da3 100644
--- a/lib/rbot/ircsocket.rb
+++ b/lib/rbot/ircsocket.rb
@@ -455,7 +455,11 @@ module Irc
if @sock.nil?
error "SEND attempted on closed socket"
else
- @sock.puts(@filter.out(message))
+ # we use Socket#syswrite() instead of Socket#puts() because
+ # the latter is racy and can cause double message output in
+ # some circumstances
+ actual = @filter.out(message) + "\n"
+ @sock.syswrite actual
@last_send = Time.new
@flood_send += message.irc_send_penalty if penalty
@lines_sent += 1