lib/dalli/socket.rb in dalli-1.1.3 vs lib/dalli/socket.rb in dalli-1.1.4
- old
+ new
@@ -26,11 +26,11 @@
def readfull(count)
value = ''
loop do
value << kgio_read!(count - value.bytesize)
break if value.bytesize == count
- end
+ end
value
end
end
@@ -147,15 +147,24 @@
rescue LoadError
puts "Could not define alternate em-synchrony socket IO" if defined?($TESTING) && $TESTING
end
-class Dalli::Server::USocket < UNIXSocket
- def readfull(count)
- value = ''
- loop do
- value << read(count - value.bytesize)
- break if value.bytesize == count
- end
- value
+require 'rbconfig'
+if RbConfig::CONFIG['host_os'] =~ /mingw|mswin/
+ class Dalli::Server::USocket
+ def initialize(*args)
+ raise Dalli::DalliError, "Unix sockets are not supported on Windows platform."
+ end
+ end
+else
+ class Dalli::Server::USocket < UNIXSocket
+ def readfull(count)
+ value = ''
+ loop do
+ value << read(count - value.bytesize)
+ break if value.bytesize == count
+ end
+ value
+ end
end
end