libsmb/conncache.c

ソースコードを見る。

データ構造

struct  failed_connection_cache

関数

NTSTATUS check_negative_conn_cache_timeout (const char *domain, const char *server, unsigned int failed_cache_timeout)
NTSTATUS check_negative_conn_cache (const char *domain, const char *server)
void add_failed_connection_entry (const char *domain, const char *server, NTSTATUS result)
void flush_negative_conn_cache (void)
void flush_negative_conn_cache_for_domain (const char *domain)

変数

static struct failed_connection_cachefailed_connection_cache


関数

NTSTATUS check_negative_conn_cache_timeout ( const char *  domain,
const char *  server,
unsigned int  failed_cache_timeout 
)

conncache.c51 行で定義されています。

参照先 failed_connection_cache::controllerfailed_connection_cache::domain_namefailed_connection_cachefailed_connection_cache::lookup_timefailed_connection_cache::nextresultstrequal().

参照元 check_negative_conn_cache().

00052 {
00053         struct failed_connection_cache *fcc;
00054         NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
00055         
00056         /* can't check if we don't have strings */
00057         
00058         if ( !domain || !server )
00059                 return NT_STATUS_OK;
00060 
00061         for (fcc = failed_connection_cache; fcc; fcc = fcc->next) {
00062         
00063                 if (!(strequal(domain, fcc->domain_name) && strequal(server, fcc->controller))) {
00064                         continue; /* no match; check the next entry */
00065                 }
00066                 
00067                 /* we have a match so see if it is still current */
00068                 if (failed_cache_timeout != (unsigned int)-1) {
00069                         if (failed_cache_timeout == 0 ||
00070                                         (time(NULL) - fcc->lookup_time) > (time_t)failed_cache_timeout) {
00071                                 /* Cache entry has expired, delete it */
00072 
00073                                 DEBUG(10, ("check_negative_conn_cache: cache entry expired for %s, %s\n", 
00074                                         domain, server ));
00075 
00076                                 DLIST_REMOVE(failed_connection_cache, fcc);
00077                                 SAFE_FREE(fcc);
00078 
00079                                 return NT_STATUS_OK;
00080                         }
00081                 }
00082 
00083                 /* The timeout hasn't expired yet so return false */
00084 
00085                 DEBUG(10, ("check_negative_conn_cache: returning negative entry for %s, %s\n", 
00086                         domain, server ));
00087 
00088                 result = fcc->nt_status;
00089                 return result;
00090         }
00091 
00092         /* end of function means no cache entry */      
00093         return NT_STATUS_OK;
00094 }

NTSTATUS check_negative_conn_cache ( const char *  domain,
const char *  server 
)

conncache.c96 行で定義されています。

参照先 check_negative_conn_cache_timeout().

参照元 add_one_dc_unique()ads_find_dc()cm_open_connection()get_dc_list()rpc_dc_name().

00097 {
00098         return check_negative_conn_cache_timeout(domain, server, FAILED_CONNECTION_CACHE_TIMEOUT);
00099 }

void add_failed_connection_entry ( const char *  domain,
const char *  server,
NTSTATUS  result 
)

conncache.c106 行で定義されています。

参照先 failed_connection_cache::controllerfailed_connection_cache::domain_namefailed_connection_cachefailed_connection_cache::lookup_timefailed_connection_cache::nextresultstrequal().

参照元 ads_find_dc()winbind_add_failed_connection_entry().

00107 {
00108         struct failed_connection_cache *fcc;
00109 
00110         SMB_ASSERT(!NT_STATUS_IS_OK(result));
00111 
00112         /* Check we already aren't in the cache.  We always have to have 
00113            a domain, but maybe not a specific DC name. */
00114 
00115         for (fcc = failed_connection_cache; fcc; fcc = fcc->next) {                     
00116                 if ( strequal(fcc->domain_name, domain) && strequal(fcc->controller, server) ) {
00117                         DEBUG(10, ("add_failed_connection_entry: domain %s (%s) already tried and failed\n",
00118                                    domain, server ));
00119                         /* Update the failed time. */
00120                         fcc->lookup_time = time(NULL);
00121                         return;
00122                 }
00123         }
00124 
00125         /* Create negative lookup cache entry for this domain and controller */
00126 
00127         if ( !(fcc = SMB_MALLOC_P(struct failed_connection_cache)) ) {
00128                 DEBUG(0, ("malloc failed in add_failed_connection_entry!\n"));
00129                 return;
00130         }
00131         
00132         ZERO_STRUCTP(fcc);
00133         
00134         fstrcpy( fcc->domain_name, domain );
00135         fstrcpy( fcc->controller, server );
00136         fcc->lookup_time = time(NULL);
00137         fcc->nt_status = result;
00138         
00139         DEBUG(10,("add_failed_connection_entry: added domain %s (%s) to failed conn cache\n",
00140                 domain, server ));
00141         
00142         DLIST_ADD(failed_connection_cache, fcc);
00143 }

void flush_negative_conn_cache ( void   ) 

conncache.c148 行で定義されています。

参照先 failed_connection_cache::next.

00149 {
00150         struct failed_connection_cache *fcc;
00151         
00152         fcc = failed_connection_cache;
00153 
00154         while (fcc) {
00155                 struct failed_connection_cache *fcc_next;
00156 
00157                 fcc_next = fcc->next;
00158                 DLIST_REMOVE(failed_connection_cache, fcc);
00159                 free(fcc);
00160 
00161                 fcc = fcc_next;
00162         }
00163 
00164 }

void flush_negative_conn_cache_for_domain ( const char *  domain  ) 

conncache.c171 行で定義されています。

参照先 failed_connection_cache::controllerfailed_connection_cache::domain_namefailed_connection_cache::nextstrequal().

参照元 winbindd_flush_negative_conn_cache().

00172 {
00173         struct failed_connection_cache *fcc;
00174         
00175         fcc = failed_connection_cache;
00176 
00177         while (fcc) {
00178                 struct failed_connection_cache *fcc_next;
00179 
00180                 fcc_next = fcc->next;
00181 
00182                 if (strequal(fcc->domain_name, domain)) {
00183                         DEBUG(10,("flush_negative_conn_cache_for_domain: removed server %s "
00184                                 " from failed cache for domain %s\n",
00185                                 fcc->controller, domain));
00186                         DLIST_REMOVE(failed_connection_cache, fcc);
00187                         free(fcc);
00188                 }
00189 
00190                 fcc = fcc_next;
00191         }
00192 }


変数

struct failed_connection_cache* failed_connection_cache [static]

conncache.c42 行で定義されています。

参照元 add_failed_connection_entry()check_negative_conn_cache_timeout().


Sambaに対してSat Aug 29 21:23:48 2009に生成されました。  doxygen 1.4.7