dcb->data is allocated before poll_add_dcb in httpd_accept()
This will prevent dcb->data to be NULL with threads
This commit is contained in:
@ -330,16 +330,16 @@ int n_connect = 0;
|
|||||||
|
|
||||||
client->state = DCB_STATE_IDLE;
|
client->state = DCB_STATE_IDLE;
|
||||||
|
|
||||||
|
/* create the session data for HTTPD */
|
||||||
|
client_data = (HTTPD_session *)calloc(1, sizeof(HTTPD_session));
|
||||||
|
client->data = client_data;
|
||||||
|
|
||||||
if (poll_add_dcb(client) == -1)
|
if (poll_add_dcb(client) == -1)
|
||||||
{
|
{
|
||||||
return n_connect;
|
return n_connect;
|
||||||
}
|
}
|
||||||
n_connect++;
|
n_connect++;
|
||||||
|
|
||||||
/* create the session data for HTTPD */
|
|
||||||
client_data = (HTTPD_session *)calloc(1, sizeof(HTTPD_session));
|
|
||||||
client->data = client_data;
|
|
||||||
|
|
||||||
client->state = DCB_STATE_POLLING;
|
client->state = DCB_STATE_POLLING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user