Permalink
Browse files

Hack for nonblocking connection problem on Windows machines

  • Loading branch information...
1 parent b9a36ca commit bc0398fc9201ada041e00b336454d5f9af362814 B. W. Lewis committed Dec 20, 2010
Showing with 7 additions and 1 deletion.
  1. +7 −1 R/controlCMD.R
View
@@ -8,7 +8,13 @@ function(host='localhost', port=6379, returnRef=FALSE)
else if(!isOpen(.redisEnv$con)) connect <- TRUE
if(connect)
{
- con <- socketConnection(host, port, open='a+b')
+# XXX R Windows suffers from a serious problem affecting non-blocking
+# connections and readBin with raw data. The unfortunate hack solution
+# is to force blocking connections on Windows systems.
+ if(Sys.info()[[1]] == "Windows")
+ con <- socketConnection(host, port, open='a+b', blocking=TRUE)
+ else
+ con <- socketConnection(host, port, open='a+b')
# Stash state in the redis enivronment describing this connection:
assign('con',con,envir=.redisEnv)
assign('host',host,envir=.redisEnv)

0 comments on commit bc0398f

Please sign in to comment.