Initial changes for persistent connections - add some basic functionality.

This commit is contained in:
counterpoint
2015-05-20 18:15:11 +01:00
parent 492918c72c
commit 6f31357372
4 changed files with 76 additions and 1 deletions

View File

@ -632,7 +632,18 @@ DCB *dcb;
GWPROTOCOL *funcs;
int fd;
int rc;
char *user;
user = session_getUser(session);
if (NULL != user && strlen(user))
{
dcb = server_get_persistent(server, user);
if (NULL != dcb)
{
return dcb;
}
}
if ((dcb = dcb_alloc(DCB_ROLE_REQUEST_HANDLER)) == NULL)
{
return NULL;
@ -1271,6 +1282,13 @@ dcb_close(DCB *dcb)
if (rc == 0)
{
spinlock_acquire(&dcb->server->persistlock);
dcb->nextpersistent = dcb->server->persistent;
dcb->server->persistent = dcb;
spinlock_release(&dcb->server->persistlock);
atomic_add(&dcb->server->stats.n_persistent, 1);
return;
/**
* close protocol and router session
*/