Commit cd3fa684 authored by unknown's avatar unknown
Browse files

IM port cleanup


server-tools/instance-manager/IMService.cpp:
  coding style fixes: tabs, trailing spaces, offset e.t.c
server-tools/instance-manager/WindowsService.cpp:
  coding style fixes: tabs, trailing spaces, offset e.t.c
server-tools/instance-manager/WindowsService.h:
  coding style fixes: tabs, trailing spaces, offset e.t.c
server-tools/instance-manager/instance.cc:
  cleanup & coding style fixes: tabs, trailing spaces, offset e.t.c
server-tools/instance-manager/listener.cc:
  coding style fixes: tabs, trailing spaces, offset e.t.c
server-tools/instance-manager/manager.cc:
  coding style fixes: tabs, trailing spaces, offset e.t.c
server-tools/instance-manager/options.cc:
  coding style fixes: tabs, trailing spaces, offset e.t.c
server-tools/instance-manager/user_map.cc:
  simplify password file processing
parent d976f87f
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -69,4 +69,3 @@ int HandleServiceOptions(Options options)
    return (int)winService.Init();
  return ret_val;
}
+42 −45
Original line number Diff line number Diff line
@@ -155,8 +155,7 @@ void WindowsService::RegisterAndRun(DWORD argc, LPTSTR *argv)
void WindowsService::HandleControlCode(DWORD opcode)
{
  // Handle the requested control code.
  switch(opcode)
  {
  switch(opcode) {
  case SERVICE_CONTROL_STOP:
    // Stop the service.
    status.dwCurrentState= SERVICE_STOP_PENDING;
@@ -201,5 +200,3 @@ void WINAPI WindowsService::ControlHandler(DWORD opcode)

  return gService->HandleControlCode(opcode);
}

+4 −5
Original line number Diff line number Diff line
@@ -41,4 +41,3 @@ class WindowsService
  void HandleControlCode(DWORD opcode);
  void RegisterAndRun(DWORD argc, LPTSTR *argv);
};
+86 −97
Original line number Diff line number Diff line
@@ -121,8 +121,7 @@ int Instance::launch_and_wait()
{
  pid_t pid= fork();

  switch (pid)
  {
  switch (pid) {
  case 0:
    execv(options.mysqld_path, options.argv);
    /* exec never returns */
@@ -215,8 +214,8 @@ void Instance::fork_and_monitor()
{
  log_info("starting instance %s", options.instance_name);

  int result= launch_and_wait();
  if (result == -1) return;
  if (launch_and_wait())
    return;                                     /* error is logged */

  /* set instance state to crashed */
  pthread_mutex_lock(&LOCK_instance);
@@ -233,9 +232,6 @@ void Instance::fork_and_monitor()
  pthread_cond_signal(&instance_map->guardian->COND_guardian);
  /* thread exits */
  return;

  /* we should never end up here */
  DBUG_ASSERT(0);
}


@@ -268,9 +264,9 @@ bool Instance::is_running()
  MYSQL mysql;
  uint port= 0;
  const char *socket= NULL;
  const char *password= "check_connection";
  const char *username= "MySQL_Instance_Manager";
  const char *access_denied_message= "Access denied for user";
  static const char *password= "check_connection";
  static const char *username= "MySQL_Instance_Manager";
  static const char *access_denied_message= "Access denied for user";
  bool return_val;

  if (options.mysqld_port)
@@ -299,15 +295,8 @@ bool Instance::is_running()
    return_val= TRUE;                           /* server is alive */
  }
  else
  {
    if (!strncmp(access_denied_message, mysql_error(&mysql),
                 sizeof(access_denied_message)-1))
    {
      return_val= TRUE;
    }
    else
      return_val= FALSE;
  }
    return_val= test(!strncmp(access_denied_message, mysql_error(&mysql),
                              sizeof(access_denied_message) - 1));

  mysql_close(&mysql);
  pthread_mutex_unlock(&LOCK_instance);
+24 −23
Original line number Diff line number Diff line
@@ -273,8 +273,8 @@ int Listener_thread::create_tcp_socket()
}

#ifndef __WIN__
int Listener_thread::create_unix_socket(
			struct sockaddr_un &unix_socket_address)
int Listener_thread::create_unix_socket(struct sockaddr_un
                                        &unix_socket_address)
{
  int unix_socket= socket(AF_UNIX, SOCK_STREAM, 0);
  if (unix_socket == INVALID_SOCKET)
@@ -322,7 +322,8 @@ int Listener_thread::create_unix_socket(
  /* make sure that instances won't be listening our sockets */
  set_no_inherit(unix_socket);

  log_info("accepting connections on unix socket %s", unix_socket_address.sun_path);
  log_info("accepting connections on unix socket %s",
           unix_socket_address.sun_path);
  sockets[num_sockets++]= unix_socket;
  FD_SET(unix_socket, &read_fds);
  return 0;
Loading