Ejemplo n.º 1
0
        bool node::is_alive() const
        {
            if (is_self()) return true;
            if (_forced_failure) return false;

            return _failure_detector.interpret() == failure_detector::UP;
        }
Ejemplo n.º 2
0
static void decrypt_dir(char *sourcedir, char* destdir)
{
    DIR *dir;
    struct dirent *dp;
    struct stat info;
    char src_path[1024], dst_path[1024];

    dir = opendir(sourcedir);
    if (!dir)
        return;

    mkdir(destdir, 0777);

    while ((dp = readdir(dir)) != NULL)
    {
        if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
        {
            // do nothing (straight logic)
        }
        else
        {
            sprintf(src_path, "%s/%s", sourcedir, dp->d_name);
            sprintf(dst_path, "%s/%s", destdir  , dp->d_name);
            if (!stat(src_path, &info))
            {
                if (S_ISDIR(info.st_mode))
                {
                    decrypt_dir(src_path, dst_path);
                }
                else
                if (S_ISREG(info.st_mode))
                {
                    if (is_self(src_path))
                        decrypt_and_dump_self(src_path, dst_path);
                }
            }
        }
    }
    closedir(dir);
}
Ejemplo n.º 3
0
 sopmq::node::intra::inode_operations& node::operations()
 {
     if (_operations_handler)
     {
         return *_operations_handler;
     }
     else
     {
         //we dont have a handler yet to make calls.
         //determine the type of handler we need and create it
         if (is_self())
         {
             //this is a local operation, ops should've been constructed already
             throw std::logic_error("tried to return non-constructed operations for a local node");
         }
         else
         {
             
         }
         
         return *_operations_handler;
     }
 }