MXS-2196: Store listener references in Service
By storing a shared pointer to the listeners in the services, they will be available as long as the service using them exists. This enables clean destruction of listeners that still have open sessions. The listener creation code now separately creates the listener and links it to the service. Also replaced relevant parts of the related code with the listener implemented versions of it.
This commit is contained in:
@ -74,14 +74,14 @@ static int test1()
|
||||
mxb_assert_message(0 != service_isvalid(service), "Service must be valid after creation");
|
||||
mxb_assert_message(0 == strcmp("MyService", service->name), "Service must have given name");
|
||||
fprintf(stderr, "\t..done\nAdding protocol testprotocol.");
|
||||
mxb_assert_message(listener_alloc(service,
|
||||
"TestProtocol",
|
||||
"mariadbclient",
|
||||
"localhost",
|
||||
9876,
|
||||
"MySQLAuth",
|
||||
NULL,
|
||||
NULL),
|
||||
mxb_assert_message(Listener::create(service,
|
||||
"TestProtocol",
|
||||
"mariadbclient",
|
||||
"localhost",
|
||||
9876,
|
||||
"MySQLAuth",
|
||||
NULL,
|
||||
NULL),
|
||||
"Add Protocol should succeed");
|
||||
mxb_assert_message(0 != serviceHasListener(service, "TestProtocol", "mariadbclient", "localhost", 9876),
|
||||
"Service should have new protocol as requested");
|
||||
|
||||
Reference in New Issue
Block a user