Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Handle partial writes with TCPSocket#syswrite

  • Loading branch information...
commit 622508726ca904b3a004fff7dea712cecf42bc70 1 parent ba9cbd5
@rfletcher authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/redis/connection/ruby.rb
View
12 lib/redis/connection/ruby.rb
@@ -54,9 +54,15 @@ def timeout=(usecs)
end
end
- def write(command)
- @sock.syswrite(build_command(*command).join(COMMAND_DELIMITER))
- end
+ def write(command)
+ command = build_command(*command).join(COMMAND_DELIMITER)
+
+ size = command.size
+ written = 0
+ begin
+ written = written + @sock.syswrite(command[written,size - written])
+ end while written < size
+ end
def read
# We read the first byte using read() mainly because gets() is
Please sign in to comment.
Something went wrong with that request. Please try again.