MXS-1752: Fail if no connections were created
If no backend connections were created, the CatSession will not be created.
This commit is contained in:
@ -33,13 +33,17 @@ Cat* Cat::create(SERVICE* pService, char** pzOptions)
|
|||||||
CatSession* Cat::newSession(MXS_SESSION* pSession)
|
CatSession* Cat::newSession(MXS_SESSION* pSession)
|
||||||
{
|
{
|
||||||
auto backends = RWBackend::from_servers(pSession->service->dbref);
|
auto backends = RWBackend::from_servers(pSession->service->dbref);
|
||||||
|
bool connected = false;
|
||||||
|
|
||||||
for (auto a = backends.begin(); a != backends.end(); a++)
|
for (auto a = backends.begin(); a != backends.end(); a++)
|
||||||
{
|
{
|
||||||
(*a)->connect(pSession);
|
if ((*a)->can_connect() && (*a)->connect(pSession))
|
||||||
|
{
|
||||||
|
connected = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CatSession(pSession, this, backends);
|
return connected ? new CatSession(pSession, this, backends) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cat::diagnostics(DCB* dcb)
|
void Cat::diagnostics(DCB* dcb)
|
||||||
|
Reference in New Issue
Block a user