Merge branch 'release-1.0beta-refresh' into blr
Fix conflict and remove some redundant code Conflicts: server/core/poll.c
This commit is contained in:
24
server/modules/protocol/CMakeLists.txt
Normal file
24
server/modules/protocol/CMakeLists.txt
Normal file
@ -0,0 +1,24 @@
|
||||
add_library(MySQLClient SHARED mysql_client.c mysql_common.c)
|
||||
target_link_libraries(MySQLClient log_manager utils)
|
||||
install(TARGETS MySQLClient DESTINATION modules)
|
||||
|
||||
add_library(MySQLBackend SHARED mysql_backend.c mysql_common.c)
|
||||
target_link_libraries(MySQLBackend log_manager utils)
|
||||
install(TARGETS MySQLBackend DESTINATION modules)
|
||||
|
||||
add_library(telnetd SHARED telnetd.c)
|
||||
target_link_libraries(telnetd log_manager utils)
|
||||
install(TARGETS telnetd DESTINATION modules)
|
||||
|
||||
add_library(HTTPD SHARED httpd.c)
|
||||
target_link_libraries(HTTPD log_manager utils)
|
||||
install(TARGETS HTTPD DESTINATION modules)
|
||||
|
||||
add_library(maxscaled SHARED maxscaled.c)
|
||||
target_link_libraries(maxscaled log_manager utils)
|
||||
install(TARGETS maxscaled DESTINATION modules)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -166,7 +166,6 @@ char *password;
|
||||
{
|
||||
dcb_printf(dcb, "FAILED");
|
||||
maxscaled->state = MAXSCALED_STATE_LOGIN;
|
||||
free(maxscaled->username);
|
||||
}
|
||||
gwbuf_consume(head, GWBUF_LENGTH(head));
|
||||
free(password);
|
||||
@ -276,16 +275,18 @@ int n_connect = 0;
|
||||
client_dcb->fd = so;
|
||||
client_dcb->remote = strdup(inet_ntoa(addr.sin_addr));
|
||||
memcpy(&client_dcb->func, &MyObject, sizeof(GWPROTOCOL));
|
||||
client_dcb->session =
|
||||
session_alloc(dcb->session->service, client_dcb);
|
||||
maxscaled_pr = (MAXSCALED *)malloc(sizeof(MAXSCALED));
|
||||
client_dcb->protocol = (void *)maxscaled_pr;
|
||||
|
||||
if (maxscaled_pr == NULL)
|
||||
{
|
||||
if ((maxscaled_pr = (MAXSCALED *)malloc(sizeof(MAXSCALED))) == NULL)
|
||||
{
|
||||
client_dcb->protocol = NULL;
|
||||
dcb_add_to_zombieslist(client_dcb);
|
||||
return n_connect;
|
||||
}
|
||||
maxscaled_pr->username = NULL;
|
||||
spinlock_init(&maxscaled_pr->lock);
|
||||
client_dcb->protocol = (void *)maxscaled_pr;
|
||||
|
||||
client_dcb->session =
|
||||
session_alloc(dcb->session->service, client_dcb);
|
||||
|
||||
if (poll_add_dcb(client_dcb) == -1)
|
||||
{
|
||||
@ -294,7 +295,6 @@ int n_connect = 0;
|
||||
}
|
||||
n_connect++;
|
||||
maxscaled_pr->state = MAXSCALED_STATE_LOGIN;
|
||||
maxscaled_pr->username = NULL;
|
||||
dcb_printf(client_dcb, "USER");
|
||||
}
|
||||
}
|
||||
@ -313,11 +313,16 @@ maxscaled_close(DCB *dcb)
|
||||
{
|
||||
MAXSCALED *maxscaled = dcb->protocol;
|
||||
|
||||
if (maxscaled && maxscaled->username)
|
||||
if (!maxscaled)
|
||||
return 0;
|
||||
|
||||
spinlock_acquire(&maxscaled->lock);
|
||||
if (maxscaled->username)
|
||||
{
|
||||
free(maxscaled->username);
|
||||
maxscaled->username = NULL;
|
||||
}
|
||||
spinlock_release(&maxscaled->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user