Skip to content
This repository has been archived by the owner on Apr 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #11 from muxspace/master
Browse files Browse the repository at this point in the history
Properly support password authentication
  • Loading branch information
bwlewis committed Mar 19, 2013
2 parents c3b0c4a + a42854e commit 51ac7c4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/controlCMD.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}

`redisConnect` <-
function(host='localhost', port=6379, returnRef=FALSE, timeout=2678399L)
function(host='localhost', port=6379, returnRef=FALSE, timeout=2678399L, password=NULL)
{
.redisEnv$current <- new.env()
# R nonblocking connections are flaky, especially on Windows, see
Expand All @@ -35,6 +35,12 @@ function(host='localhost', port=6379, returnRef=FALSE, timeout=2678399L)
# Count is for nonblocking communication, it keeps track of the number of
# getResponse calls that are pending.
assign('count',0,envir=.redisEnv$current)
if (!is.null(password)) tryCatch(redisAuth(password),
error=function(e) {
cat(paste('Error: ',e,'\n'))
close(con);
rm(list='con',envir=.redisEnv$current)
})
tryCatch(.redisPP(),
error=function(e) {
cat(paste('Error: ',e,'\n'))
Expand Down

0 comments on commit 51ac7c4

Please sign in to comment.