mirror of
https://github.com/fluencelabs/redis
synced 2025-06-15 18:21:21 +00:00
TLS: Connections refactoring and TLS support.
* Introduce a connection abstraction layer for all socket operations and integrate it across the code base. * Provide an optional TLS connections implementation based on OpenSSL. * Pull a newer version of hiredis with TLS support. * Tests, redis-cli updates for TLS support.
This commit is contained in:
@ -58,7 +58,7 @@ sds ldbCatStackValue(sds s, lua_State *lua, int idx);
|
||||
#define LDB_BREAKPOINTS_MAX 64 /* Max number of breakpoints. */
|
||||
#define LDB_MAX_LEN_DEFAULT 256 /* Default len limit for replies / var dumps. */
|
||||
struct ldbState {
|
||||
int fd; /* Socket of the debugging client. */
|
||||
connection *conn; /* Connection of the debugging client. */
|
||||
int active; /* Are we debugging EVAL right now? */
|
||||
int forked; /* Is this a fork()ed debugging session? */
|
||||
list *logs; /* List of messages to send to the client. */
|
||||
@ -1109,7 +1109,7 @@ void scriptingInit(int setup) {
|
||||
* Note: there is no need to create it again when this function is called
|
||||
* by scriptingReset(). */
|
||||
if (server.lua_client == NULL) {
|
||||
server.lua_client = createClient(-1);
|
||||
server.lua_client = createClient(NULL);
|
||||
server.lua_client->flags |= CLIENT_LUA;
|
||||
}
|
||||
|
||||
@ -1593,7 +1593,7 @@ NULL
|
||||
|
||||
/* Initialize Lua debugger data structures. */
|
||||
void ldbInit(void) {
|
||||
ldb.fd = -1;
|
||||
ldb.conn = NULL;
|
||||
ldb.active = 0;
|
||||
ldb.logs = listCreate();
|
||||
listSetFreeMethod(ldb.logs,(void (*)(void*))sdsfree);
|
||||
@ -1615,7 +1615,7 @@ void ldbFlushLog(list *log) {
|
||||
void ldbEnable(client *c) {
|
||||
c->flags |= CLIENT_LUA_DEBUG;
|
||||
ldbFlushLog(ldb.logs);
|
||||
ldb.fd = c->fd;
|
||||
ldb.conn = c->conn;
|
||||
ldb.step = 1;
|
||||
ldb.bpcount = 0;
|
||||
ldb.luabp = 0;
|
||||
@ -1670,7 +1670,7 @@ void ldbSendLogs(void) {
|
||||
proto = sdscatlen(proto,"\r\n",2);
|
||||
listDelNode(ldb.logs,ln);
|
||||
}
|
||||
if (write(ldb.fd,proto,sdslen(proto)) == -1) {
|
||||
if (connWrite(ldb.conn,proto,sdslen(proto)) == -1) {
|
||||
/* Avoid warning. We don't check the return value of write()
|
||||
* since the next read() will catch the I/O error and will
|
||||
* close the debugging session. */
|
||||
@ -1723,8 +1723,8 @@ int ldbStartSession(client *c) {
|
||||
}
|
||||
|
||||
/* Setup our debugging session. */
|
||||
anetBlock(NULL,ldb.fd);
|
||||
anetSendTimeout(NULL,ldb.fd,5000);
|
||||
connBlock(ldb.conn);
|
||||
connSendTimeout(ldb.conn,5000);
|
||||
ldb.active = 1;
|
||||
|
||||
/* First argument of EVAL is the script itself. We split it into different
|
||||
@ -1751,7 +1751,7 @@ void ldbEndSession(client *c) {
|
||||
|
||||
/* If it's a fork()ed session, we just exit. */
|
||||
if (ldb.forked) {
|
||||
writeToClient(c->fd, c, 0);
|
||||
writeToClient(c,0);
|
||||
serverLog(LL_WARNING,"Lua debugging session child exiting");
|
||||
exitFromChild(0);
|
||||
} else {
|
||||
@ -1760,8 +1760,8 @@ void ldbEndSession(client *c) {
|
||||
}
|
||||
|
||||
/* Otherwise let's restore client's state. */
|
||||
anetNonBlock(NULL,ldb.fd);
|
||||
anetSendTimeout(NULL,ldb.fd,0);
|
||||
connNonBlock(ldb.conn);
|
||||
connSendTimeout(ldb.conn,0);
|
||||
|
||||
/* Close the client connectin after sending the final EVAL reply
|
||||
* in order to signal the end of the debugging session. */
|
||||
@ -2332,7 +2332,7 @@ int ldbRepl(lua_State *lua) {
|
||||
while(1) {
|
||||
while((argv = ldbReplParseCommand(&argc)) == NULL) {
|
||||
char buf[1024];
|
||||
int nread = read(ldb.fd,buf,sizeof(buf));
|
||||
int nread = connRead(ldb.conn,buf,sizeof(buf));
|
||||
if (nread <= 0) {
|
||||
/* Make sure the script runs without user input since the
|
||||
* client is no longer connected. */
|
||||
|
Reference in New Issue
Block a user