Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Knot DNS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
22
Issues
22
List
Boards
Labels
Service Desk
Milestones
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Knot projects
Knot DNS
Commits
57b592bc
Commit
57b592bc
authored
Jan 26, 2016
by
Daniel Salzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: get rid of conf_post_open
parent
7bc69184
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
66 deletions
+30
-66
src/knot/conf/base.c
src/knot/conf/base.c
+19
-21
src/knot/conf/base.h
src/knot/conf/base.h
+0
-11
src/knot/server/server.c
src/knot/server/server.c
+3
-8
src/utils/knotc/main.c
src/utils/knotc/main.c
+0
-8
src/utils/knotd/main.c
src/utils/knotd/main.c
+3
-7
tests/test_conf.h
tests/test_conf.h
+5
-11
No files found.
src/knot/conf/base.c
View file @
57b592bc
...
...
@@ -137,6 +137,19 @@ int conf_refresh(
return
conf
->
api
->
txn_begin
(
conf
->
db
,
&
conf
->
read_txn
,
KNOT_DB_RDONLY
);
}
static
void
init_values
(
conf_t
*
conf
)
{
conf
->
hostname
=
sockaddr_hostname
();
conf
->
cache
.
srv_nsid
=
conf_get
(
conf
,
C_SRV
,
C_NSID
);
conf
->
cache
.
srv_max_udp_payload
=
conf_get
(
conf
,
C_SRV
,
C_MAX_UDP_PAYLOAD
);
conf
->
cache
.
srv_max_tcp_clients
=
conf_get
(
conf
,
C_SRV
,
C_MAX_TCP_CLIENTS
);
conf
->
cache
.
srv_tcp_hshake_timeout
=
conf_get
(
conf
,
C_SRV
,
C_TCP_HSHAKE_TIMEOUT
);
conf
->
cache
.
srv_tcp_idle_timeout
=
conf_get
(
conf
,
C_SRV
,
C_TCP_IDLE_TIMEOUT
);
conf
->
cache
.
srv_tcp_reply_timeout
=
conf_get
(
conf
,
C_SRV
,
C_TCP_REPLY_TIMEOUT
);
}
int
conf_new
(
conf_t
**
conf
,
const
yp_item_t
*
scheme
,
...
...
@@ -222,6 +235,9 @@ int conf_new(
// Initialize query modules list.
init_list
(
&
out
->
query_modules
);
// Initialize cached values.
init_values
(
out
);
*
conf
=
out
;
return
KNOT_EOK
;
...
...
@@ -275,6 +291,9 @@ int conf_clone(
// Initialize query modules list.
init_list
(
&
out
->
query_modules
);
// Initialize cached values.
init_values
(
out
);
out
->
is_clone
=
true
;
*
conf
=
out
;
...
...
@@ -282,27 +301,6 @@ int conf_clone(
return
KNOT_EOK
;
}
int
conf_post_open
(
conf_t
*
conf
)
{
if
(
conf
==
NULL
)
{
return
KNOT_EINVAL
;
}
conf
->
hostname
=
sockaddr_hostname
();
conf
->
cache
.
srv_nsid
=
conf_get
(
conf
,
C_SRV
,
C_NSID
);
conf
->
cache
.
srv_max_udp_payload
=
conf_get
(
conf
,
C_SRV
,
C_MAX_UDP_PAYLOAD
);
conf
->
cache
.
srv_max_tcp_clients
=
conf_get
(
conf
,
C_SRV
,
C_MAX_TCP_CLIENTS
);
conf
->
cache
.
srv_tcp_hshake_timeout
=
conf_get
(
conf
,
C_SRV
,
C_TCP_HSHAKE_TIMEOUT
);
conf
->
cache
.
srv_tcp_idle_timeout
=
conf_get
(
conf
,
C_SRV
,
C_TCP_IDLE_TIMEOUT
);
conf
->
cache
.
srv_tcp_reply_timeout
=
conf_get
(
conf
,
C_SRV
,
C_TCP_REPLY_TIMEOUT
);
conf_activate_modules
(
conf
,
NULL
,
&
conf
->
query_modules
,
&
conf
->
query_plan
);
return
KNOT_EOK
;
}
void
conf_update
(
conf_t
*
conf
)
{
...
...
src/knot/conf/base.h
View file @
57b592bc
...
...
@@ -160,17 +160,6 @@ int conf_clone(
conf_t
**
conf
);
/*!
* Processes some additional operations and checks after configuration loading.
*
* \param[in] conf Configuration.
*
* \return Error code, KNOT_EOK if success.
*/
int
conf_post_open
(
conf_t
*
conf
);
/*!
* Replaces the active configuration with the specified one.
*
...
...
src/knot/server/server.c
View file @
57b592bc
...
...
@@ -504,14 +504,9 @@ int server_reload(server_t *server, const char *cf)
log_info
(
"reloading configuration database"
);
}
/* Run post-open config operations. */
ret
=
conf_post_open
(
new_conf
);
if
(
ret
!=
KNOT_EOK
)
{
log_error
(
"failed to use configuration (%s)"
,
knot_strerror
(
ret
));
conf_free
(
new_conf
);
return
ret
;
}
/* Activate global query modules. */
conf_activate_modules
(
new_conf
,
NULL
,
&
new_conf
->
query_modules
,
&
new_conf
->
query_plan
);
/* Update to the new config. */
conf_update
(
new_conf
);
...
...
src/utils/knotc/main.c
View file @
57b592bc
...
...
@@ -119,14 +119,6 @@ static int set_config(const cmd_desc_t *desc, const char *confdb,
}
}
/* Finalize the config (needed for conf check and cached items). */
ret
=
conf_post_open
(
new_conf
);
if
(
ret
!=
KNOT_EOK
)
{
log_error
(
"failed to use configuration (%s)"
,
knot_strerror
(
ret
));
conf_free
(
new_conf
);
return
ret
;
}
/* Update to the new config. */
conf_update
(
new_conf
);
...
...
src/utils/knotd/main.c
View file @
57b592bc
...
...
@@ -332,13 +332,9 @@ static int set_config(const char *confdb, const char *config)
}
}
/* Run post-open config operations. */
ret
=
conf_post_open
(
new_conf
);
if
(
ret
!=
KNOT_EOK
)
{
log_fatal
(
"failed to use configuration (%s)"
,
knot_strerror
(
ret
));
conf_free
(
new_conf
);
return
ret
;
}
/* Activate global query modules. */
conf_activate_modules
(
new_conf
,
NULL
,
&
new_conf
->
query_modules
,
&
new_conf
->
query_plan
);
/* Update to the new config. */
conf_update
(
new_conf
);
...
...
tests/test_conf.h
View file @
57b592bc
...
...
@@ -27,25 +27,19 @@ static inline int test_conf(const char *conf_str, const yp_item_t *scheme)
scheme
=
conf_scheme
;
}
conf_t
*
conf
;
int
ret
=
conf_new
(
&
conf
,
scheme
,
NULL
,
CONF_FNONE
);
conf_t
*
new_conf
=
NULL
;
int
ret
=
conf_new
(
&
new_
conf
,
scheme
,
NULL
,
CONF_FNONE
);
if
(
ret
!=
KNOT_EOK
)
{
return
ret
;
}
ret
=
conf_import
(
conf
,
conf_str
,
false
);
ret
=
conf_import
(
new_
conf
,
conf_str
,
false
);
if
(
ret
!=
KNOT_EOK
)
{
conf_free
(
conf
);
conf_free
(
new_
conf
);
return
ret
;
}
ret
=
conf_post_open
(
conf
);
if
(
ret
!=
KNOT_EOK
)
{
conf_free
(
conf
);
return
ret
;
}
conf_update
(
conf
);
conf_update
(
new_conf
);
return
KNOT_EOK
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment