43 event_handler_map = cxHashMapCreate(cxDefaultAllocator, 16); |
43 event_handler_map = cxHashMapCreate(cxDefaultAllocator, 16); |
44 } |
44 } |
45 |
45 |
46 CxHashKey key = cx_hash_key_bytes((const unsigned char*)cfg->name.ptr, cfg->name.length); |
46 CxHashKey key = cx_hash_key_bytes((const unsigned char*)cfg->name.ptr, cfg->name.length); |
47 |
47 |
48 /* if the event handler already exists, we don't modify it */ |
48 // if the event handler already exists, we don't modify it |
49 if(cxMapGet(event_handler_map, key)) { |
49 if(cxMapGet(event_handler_map, key)) { |
50 /* TODO: log message */ |
50 /* TODO: log message */ |
51 /* TODO: set reload status */ |
51 /* TODO: set reload status */ |
|
52 log_ereport(LOG_DEBUG, "event handler %s already exists", cfg->name.ptr); |
52 return 0; |
53 return 0; |
53 } |
54 } |
54 |
55 |
55 /* create new handler */ |
56 // create new handler |
56 EVHandler *e = evhandler_create(cfg); |
57 EVHandler *e = evhandler_create(cfg); |
57 if(e == NULL) { |
58 if(e == NULL) { |
|
59 log_ereport(LOG_FAILURE, "evhandler_create failed"); |
58 return 1; |
60 return 1; |
59 } |
61 } |
60 |
62 |
61 if(cfg->isdefault) { |
63 if(cfg->isdefault) { |
62 if(default_event_handler) { |
64 if(default_event_handler) { |