diff --git a/include/maxscale/dcb.h b/include/maxscale/dcb.h index f578957b3..d598d1678 100644 --- a/include/maxscale/dcb.h +++ b/include/maxscale/dcb.h @@ -252,7 +252,6 @@ void dcb_printf(DCB *, const char *, ...) __attribute__((format(printf, 2, 3))); void dcb_hashtable_stats(DCB *, void *); /**< Print statisitics */ int dcb_add_callback(DCB *, DCB_REASON, int (*)(struct dcb *, DCB_REASON, void *), void *); int dcb_remove_callback(DCB *, DCB_REASON, int (*)(struct dcb *, DCB_REASON, void *), void *); -int dcb_isvalid(DCB *); /* Check the DCB is in the linked list */ int dcb_count_by_usage(DCB_USAGE); /* Return counts of DCBs */ int dcb_persistent_clean_count(DCB *, int, bool); /* Clean persistent and return count */ void dcb_hangup_foreach (struct server* server); diff --git a/server/core/dcb.cc b/server/core/dcb.cc index b15e1690a..488554fbd 100644 --- a/server/core/dcb.cc +++ b/server/core/dcb.cc @@ -1950,18 +1950,6 @@ dcb_call_callback(DCB *dcb, DCB_REASON reason) } } -/** - * Check the passed DCB to ensure it is in the list of all DCBS - * - * @param dcb The DCB to check - * @return 1 if the DCB is in the list, otherwise 0 - */ -int -dcb_isvalid(DCB *dcb) -{ - return !!dcb; -} - static void dcb_hangup_foreach_worker(int thread_id, struct server* server) { for (DCB *dcb = this_unit.all_dcbs[thread_id]; dcb; dcb = dcb->thread.next) diff --git a/server/core/test/testadminusers.cc b/server/core/test/testadminusers.cc index 7622eaa19..c9cd56ee7 100644 --- a/server/core/test/testadminusers.cc +++ b/server/core/test/testadminusers.cc @@ -247,6 +247,7 @@ main(int argc, char **argv) unlink(buf); + admin_users_init(); result += test1(); result += test2(); result += test3(); diff --git a/server/core/test/testdcb.cc b/server/core/test/testdcb.cc index 7e50ceab9..7d305f1c2 100644 --- a/server/core/test/testdcb.cc +++ b/server/core/test/testdcb.cc @@ -35,9 +35,10 @@ #include #include -#include #include +#include "../dcb.cc" + /** * test1 Allocate a dcb and do lots of other things * @@ -48,17 +49,16 @@ test1() DCB *dcb; SERV_LISTENER dummy; /* Single buffer tests */ - ss_dfprintf(stderr, "testdcb : creating buffer with type DCB_ROLE_SERVICE_LISTENER"); + ss_dfprintf(stderr, "testdcb : creating buffer with type DCB_ROLE_INTERNAL"); dcb = dcb_alloc(DCB_ROLE_INTERNAL, &dummy); printDCB(dcb); - ss_info_dassert(dcb_isvalid(dcb), "New DCB must be valid"); ss_dfprintf(stderr, "\t..done\nAllocated dcb."); printAllDCBs(); ss_dfprintf(stderr, "\t..done\n"); dcb->state = DCB_STATE_POLLING; + this_thread.current_dcb = dcb; dcb_close(dcb); ss_dfprintf(stderr, "Freed original dcb"); - ss_info_dassert(!dcb_isvalid(dcb), "Closed DCB must not be valid"); ss_dfprintf(stderr, "\t..done\n"); return 0; diff --git a/server/core/test/testpoll.cc b/server/core/test/testpoll.cc index 278ab9870..c33278877 100644 --- a/server/core/test/testpoll.cc +++ b/server/core/test/testpoll.cc @@ -35,6 +35,7 @@ #include #include #include +#include #include "test_utils.h" @@ -97,6 +98,8 @@ test1() sleep(10); //TODO, fix this for workers: poll_shutdown(); ss_dfprintf(stderr, "\t..done\nTidy up."); + SERVICE my_service = {}; + dcb->service = &my_service; dcb_close(dcb); ss_dfprintf(stderr, "\t..done\n");