MXS-2196: Use Listener in MXS_PROTOCOL::accept

This commit is contained in:
Markus Mäkelä
2018-11-30 18:08:55 +02:00
parent 45827dd433
commit e46104c32a
7 changed files with 27 additions and 21 deletions

View File

@ -61,7 +61,7 @@ static int maxscaled_write_event(DCB* dcb);
static int maxscaled_write(DCB* dcb, GWBUF* queue);
static int maxscaled_error(DCB* dcb);
static int maxscaled_hangup(DCB* dcb);
static int maxscaled_accept(DCB* dcb);
static int maxscaled_accept(const SListener& listener);
static int maxscaled_close(DCB* dcb);
static char* mxsd_default_auth();
@ -345,14 +345,14 @@ static int maxscaled_hangup(DCB* dcb)
* @param dcb The descriptor control block
* @return The number of new connections created
*/
static int maxscaled_accept(DCB* listener)
static int maxscaled_accept(const SListener& listener)
{
int n_connect = 0;
DCB* client_dcb;
socklen_t len = sizeof(struct ucred);
struct ucred ucred;
while ((client_dcb = dcb_accept(listener->listener)) != NULL)
while ((client_dcb = dcb_accept(listener)) != NULL)
{
MAXSCALED* maxscaled_protocol = (MAXSCALED*)calloc(1, sizeof(MAXSCALED));
@ -377,7 +377,7 @@ static int maxscaled_accept(DCB* listener)
pthread_mutex_init(&maxscaled_protocol->lock, NULL);
client_dcb->protocol = (void*)maxscaled_protocol;
client_dcb->session = session_alloc(listener->session->service, client_dcb);
client_dcb->session = session_alloc(listener->service(), client_dcb);
if (NULL == client_dcb->session || poll_add_dcb(client_dcb))
{