|
|
| version 1.1, 2012/02/21 22:30:18 | version 1.1.1.1, 2012/10/09 09:06:54 |
|---|---|
| Line 3 | Line 3 |
| Persistent database management routines for DHCPD... */ | Persistent database management routines for DHCPD... */ |
| /* | /* |
| * Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") | * Copyright (c) 2004-2010,2012 by Internet Systems Consortium, Inc. ("ISC") |
| * Copyright (c) 1995-2003 by Internet Software Consortium | * Copyright (c) 1995-2003 by Internet Software Consortium |
| * | * |
| * Permission to use, copy, modify, and distribute this software for any | * Permission to use, copy, modify, and distribute this software for any |
| Line 36 | Line 36 |
| #include <ctype.h> | #include <ctype.h> |
| #include <errno.h> | #include <errno.h> |
| #define LEASE_REWRITE_PERIOD 3600 | |
| static isc_result_t write_binding_scope(FILE *db_file, struct binding *bnd, | static isc_result_t write_binding_scope(FILE *db_file, struct binding *bnd, |
| char *prepend); | char *prepend); |
| Line 988 int commit_leases () | Line 990 int commit_leases () |
| /* If we haven't rewritten the lease database in over an | /* If we haven't rewritten the lease database in over an |
| hour, rewrite it now. (The length of time should probably | hour, rewrite it now. (The length of time should probably |
| be configurable. */ | be configurable. */ |
| if (count && cur_time - write_time > 3600) { | if (count && cur_time - write_time > LEASE_REWRITE_PERIOD) { |
| count = 0; | count = 0; |
| write_time = cur_time; | write_time = cur_time; |
| new_lease_file (); | new_lease_file (); |
| Line 996 int commit_leases () | Line 998 int commit_leases () |
| return 1; | return 1; |
| } | } |
| /* | |
| * rewrite the lease file about once an hour | |
| * This is meant as a quick patch for ticket 24887. It allows | |
| * us to rotate the v6 lease file without adding too many fsync() | |
| * calls. In the future wes should revisit this area and add | |
| * something similar to the delayed ack code for v4. | |
| */ | |
| int commit_leases_timed() | |
| { | |
| if ((count != 0) && (cur_time - write_time > LEASE_REWRITE_PERIOD)) { | |
| return (commit_leases()); | |
| } | |
| return (1); | |
| } | |
| void db_startup (testp) | void db_startup (testp) |
| int testp; | int testp; |
| { | { |
| Line 1007 void db_startup (testp) | Line 1024 void db_startup (testp) |
| /* Read in the existing lease file... */ | /* Read in the existing lease file... */ |
| status = read_conf_file (path_dhcpd_db, | status = read_conf_file (path_dhcpd_db, |
| (struct group *)0, 0, 1); | (struct group *)0, 0, 1); |
| /* XXX ignore status? */ | if (status != ISC_R_SUCCESS) { |
| /* XXX ignore status? */ | |
| ; | |
| } | |
| #if defined (TRACING) | #if defined (TRACING) |
| } | } |
| #endif | #endif |