+Thu Mar 28 19:02:05 EET 2002 Pekka Riikonen <priikone@silcnet.org>
+
+ * Created new branch silc_protocol_1_0_branch.
+
+ * Reverted the silc_log_quick change in lib/silcutil/silclog.c.
+
+ * Changed the silc_server_config_* routines to be SilcServer
+ independent. They are now officially application specific code
+ and not part of generic server implementation. Affected files
+ are silcd/serverconfig.[ch], silcd/silcd.c, silcd/server.c.
+
Thu Mar 28 17:01:43 EET 2002 Pekka Riikonen <priikone@silcnet.org>
* Added automatic referencing of config context in the
silc_dlist_uninit(server->sim);
#endif
+ silc_server_config_unref(&server->config_ref);
if (server->rng)
silc_rng_free(server->rng);
if (server->pkcs)
assert(server);
assert(server->config);
+ silc_server_config_ref(&server->config_ref, server->config,
+ server->config);
+
/* Set public and private keys */
if (!server->config->server_info ||
!server->config->server_info->public_key ||
{
SilcServerConfig newconfig;
+ /* Our old config is gone now. We'll unreference our reference made in
+ silc_server_init and then destroy it since we are destroying it
+ underneath the application (layer which called silc_server_init). */
+ silc_server_config_unref(&server->config_ref);
+ silc_server_config_destroy(server->config);
+
/* Reset the logging system */
silc_log_quick = TRUE;
silc_log_flush_all();
/* Start the main rehash phase (read again the config file) */
SILC_LOG_INFO(("Rehashing server"));
- newconfig = silc_server_config_alloc(server, server->config_file);
+ newconfig = silc_server_config_alloc(server->config_file);
if (!newconfig) {
SILC_LOG_ERROR(("Rehash FAILED."));
return FALSE;
}
- /* Destroy old config context. This is destroyed if no one is referencing
- it at the moment. */
- silc_server_config_destroy(server->config);
+ /* Take new config context */
server->config = newconfig;
+ silc_server_config_ref(&server->config_ref, server->config, server->config);
/* Set public and private keys */
if (!server->config->server_info ||
}
/* Allocates a new configuration object, opens configuration file and
- * parses it. The parsed data is returned to the newly allocated
- * configuration object. */
+ parses it. The parsed data is returned to the newly allocated
+ configuration object. The SilcServerConfig must be freed by calling
+ the silc_server_config_destroy function. */
-SilcServerConfig silc_server_config_alloc(SilcServer server,
- const char *filename)
+SilcServerConfig silc_server_config_alloc(const char *filename)
{
SilcServerConfig config_new;
SilcConfigEntity ent;
/* Set default to configuration parameters */
silc_server_config_set_defaults(config_new);
- silc_server_config_ref(&server->config_ref, config_new, config_new);
+ config_new->refcount = 1;
return config_new;
}
void silc_server_config_unref(SilcServerConfigRef *ref)
{
- SilcServerConfig config = ref->config;
- if (ref->ref_ptr) {
- config->refcount--;
- SILC_LOG_DEBUG(("Unreferencing config [%p] refcnt %hu->%hu", config,
- config->refcount + 1, config->refcount));
- if (!config->refcount)
- silc_server_config_destroy(config);
- }
+ if (ref->ref_ptr)
+ silc_server_config_destroy(ref->config);
}
/* Destroy a config object with all his children lists */
{
void *tmp;
- if (config->refcount > 0) {
- config->refcount--;
- SILC_LOG_DEBUG(("Unreferencing config [%p] refcnt %hu->%hu", config,
- config->refcount + 1, config->refcount));
- if (config->refcount > 0)
- return;
- }
+ config->refcount--;
+ SILC_LOG_DEBUG(("Unreferencing config [%p] refcnt %hu->%hu", config,
+ config->refcount + 1, config->refcount));
+ if (config->refcount > 0)
+ return;
SILC_LOG_DEBUG(("Freeing config context"));
void *tmp;
/* Reference count (when this reaches zero, config object is destroyed) */
- SilcUInt16 refcount;
+ SilcInt16 refcount;
/* The General section */
char *module_path;
/* Prototypes */
/* Basic config operations */
-SilcServerConfig silc_server_config_alloc(SilcServer server,
- const char *filename);
+SilcServerConfig silc_server_config_alloc(const char *filename);
void silc_server_config_destroy(SilcServerConfig config);
void silc_server_config_ref(SilcServerConfigRef *ref, SilcServerConfig config,
void *ref_ptr);
goto fail;
/* Read configuration files */
- silcd->config = silc_server_config_alloc(silcd, silcd_config_file);
+ silcd->config = silc_server_config_alloc(silcd_config_file);
if (silcd->config == NULL)
goto fail;
silcd->config_file = silcd_config_file;
SILC_TASK_CALLBACK(silc_log_fflush_callback)
{
unsigned int u;
- if (silc_log_quick) {
+ if (!silc_log_quick) {
silc_log_flush_all();
SILC_FOREACH_LOG(u)
silc_log_checksize(&silclogs[u]);