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

Properly support password authentication #11

Merged
merged 1 commit into from
Mar 19, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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