fixed pipe mapping for modules
This commit is contained in:
@@ -474,8 +474,20 @@ int FDAPI_pipe(int *pfds) {
|
||||
// Not passing _O_NOINHERIT, the underlying handles are inheritable by default
|
||||
result = crt_pipe(pfds, 8192, _O_BINARY);
|
||||
if (result == 0) {
|
||||
//pfds[0] = RFDMap::getInstance().addCrtFD(pfds[0]);
|
||||
//pfds[1] = RFDMap::getInstance().addCrtFD(pfds[1]);
|
||||
pfds[0] = RFDMap::getInstance().addCrtFD(pfds[0]);
|
||||
pfds[1] = RFDMap::getInstance().addCrtFD(pfds[1]);
|
||||
}
|
||||
} CATCH_AND_REPORT();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int FDAPI_pipe_for_modules(int* pfds) {
|
||||
int result = -1;
|
||||
try {
|
||||
// Not passing _O_NOINHERIT, the underlying handles are inheritable by default
|
||||
result = crt_pipe(pfds, 8192, _O_BINARY);
|
||||
if (result == 0) {
|
||||
//[tporadowski] when pipe is created for communication with modules - pretend it is a socket to
|
||||
// get proper SocketInfo instance created and added in RFDMap; it is later needed
|
||||
// when creating AE events in server.c/initServer()
|
||||
|
||||
@@ -220,6 +220,8 @@ extern int FDAPI_setmode(int fd, int mode);
|
||||
extern size_t FDAPI_fwrite(const void *buffer, size_t size, size_t count, FILE *file);
|
||||
extern int FDAPI_fileno(FILE *file);
|
||||
|
||||
int FDAPI_pipe_for_modules(int* pfds);
|
||||
|
||||
// Macroize CRT definitions to point to our own
|
||||
#ifndef FDAPI_NOCRTREDEFS
|
||||
#define close(fd) FDAPI_close(fd)
|
||||
|
||||
@@ -223,7 +223,7 @@ static void killAppendOnlyChild(void) {
|
||||
POSIX_ONLY(int statloc;)
|
||||
|
||||
/* No AOFRW child? return. */
|
||||
if (server.aof_child_pid != -1)return;
|
||||
if (server.aof_child_pid == -1)return;
|
||||
|
||||
/* Kill AOFRW child, wait for child exit. */
|
||||
|
||||
|
||||
+1
-1
@@ -3902,7 +3902,7 @@ void moduleInitModulesSystem(void) {
|
||||
moduleKeyspaceSubscribersClient->flags |= CLIENT_MODULE;
|
||||
|
||||
moduleRegisterCoreAPI();
|
||||
if (pipe(server.module_blocked_pipe) == -1) {
|
||||
if (IF_WIN32(FDAPI_pipe_for_modules,pipe)(server.module_blocked_pipe) == -1) {
|
||||
serverLog(LL_WARNING,
|
||||
"Can't create the pipe for module blocking commands: %s",
|
||||
IF_WIN32(wsa_strerror(errno), strerror(errno)));
|
||||
|
||||
Reference in New Issue
Block a user