Commit 55b4cb00 authored by unknown's avatar unknown
Browse files

alot of formatting changes that came out of JimW's review


server-tools/instance-manager/IMService.cpp:
  fixed tabs and spacing per JimW's review
server-tools/instance-manager/WindowsService.cpp:
  fixed tabs and spacing per JimW's review
server-tools/instance-manager/WindowsService.h:
  fixed tabs and spacing per JimW's review
server-tools/instance-manager/commands.cc:
  fixed tabs and spacing per JimW's review
server-tools/instance-manager/instance.cc:
  fixed tabs and spacing per JimW's review
server-tools/instance-manager/instance_map.cc:
  fixed tabs and spacing per JimW's review
server-tools/instance-manager/listener.cc:
  fixed tabs and spacing per JimW's review
server-tools/instance-manager/manager.cc:
  fixed tabs and spacing per JimW's review
server-tools/instance-manager/options.cc:
  fixed tabs and spacing per JimW's review
server-tools/instance-manager/user_map.cc:
  fixed tabs and spacing per JimW's review
parent 875b0e63
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ void IMService::Run()
  ReportStatus((DWORD)SERVICE_START_PENDING);

  // init goes here

  ReportStatus((DWORD)SERVICE_RUNNING);

  // wait for main loop to terminate
+102 −97
Original line number Diff line number Diff line
@@ -4,8 +4,10 @@

static WindowsService *gService;

WindowsService::WindowsService(void)
: statusCheckpoint(0), serviceName(NULL), inited(false),
WindowsService::WindowsService(void) : 
  statusCheckpoint(0), 
  serviceName(NULL), 
  inited(false),
  dwAcceptedControls(SERVICE_ACCEPT_STOP)
{
  gService= this;
@@ -34,9 +36,10 @@ BOOL WindowsService::Install()
    return false;

  newService= CreateService(scm, serviceName, displayName,
			SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START,
			SERVICE_ERROR_NORMAL, szFilePath,	
			NULL, NULL, NULL, username, password);
                             SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, 
                             SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, 
                             szFilePath, NULL, NULL, NULL, username, 
                             password);

  if (newService)
  {
@@ -109,7 +112,8 @@ void WindowsService::SetAcceptedControls(DWORD acceptedControls)
}


BOOL WindowsService::ReportStatus(DWORD currentState, DWORD waitHint, DWORD dwError)
BOOL WindowsService::ReportStatus(DWORD currentState, DWORD waitHint, 
                                  DWORD dwError)
{
  if(debugging) return TRUE;

@@ -119,7 +123,8 @@ BOOL WindowsService::ReportStatus(DWORD currentState, DWORD waitHint, DWORD dwEr
      status.dwControlsAccepted= dwAcceptedControls;

  status.dwCurrentState= currentState;
    status.dwWin32ExitCode = dwError != 0 ? ERROR_SERVICE_SPECIFIC_ERROR : NO_ERROR;
  status.dwWin32ExitCode= dwError != 0 ? 
    ERROR_SERVICE_SPECIFIC_ERROR : NO_ERROR;
  status.dwWaitHint= waitHint;
  status.dwServiceSpecificExitCode= dwError;

+44 −44
Original line number Diff line number Diff line
@@ -377,7 +377,8 @@ BOOL SafeTerminateProcess(HANDLE hProcess, UINT uExitCode)
  BOOL bSuccess= FALSE;

  BOOL bDup= DuplicateHandle(GetCurrentProcess(),
    hProcess, GetCurrentProcess(), &hProcessDup, PROCESS_ALL_ACCESS, FALSE, 0);
                             hProcess, GetCurrentProcess(), &hProcessDup, 
                             PROCESS_ALL_ACCESS, FALSE, 0);

  // Detect the special case where the process is
  // already dead...
@@ -389,15 +390,14 @@ BOOL SafeTerminateProcess(HANDLE hProcess, UINT uExitCode)
      pfnExitProc= GetProcAddress(hKernel, "ExitProcess");

      hRT= CreateRemoteThread((bDup) ? hProcessDup : hProcess, NULL, 0,
        (LPTHREAD_START_ROUTINE)pfnExitProc, (PVOID)uExitCode, 0, &dwTID);
                              (LPTHREAD_START_ROUTINE)pfnExitProc, 
                              (PVOID)uExitCode, 0, &dwTID);

      if (hRT == NULL)
          dwErr= GetLastError();
  }
  else
  {
      dwErr= ERROR_PROCESS_ABORTED;
  }

  if (hRT)
  {
+2 −2
Original line number Diff line number Diff line
@@ -256,8 +256,8 @@ int Instance_map::load()
  else
    argv_options[1]= '\0';

  if (my_search_option_files(Options::config_file, &argc, (char ***) &argv, &args_used,
                             process_option, (void*) this) ||
  if (my_search_option_files(Options::config_file, &argc, (char ***) &argv, 
                             &args_used, process_option, (void*) this) ||
      complete_initialization())
    return 1;

+16 −12
Original line number Diff line number Diff line
@@ -66,8 +66,8 @@ Listener_thread::Listener_thread(const Listener_thread_args &args) :
                       args.instance_map)
  ,total_connection_count(0)
  ,thread_info(pthread_self())
  ,num_sockets(0)
{
  num_sockets= 0;
}


@@ -120,7 +120,7 @@ void Listener_thread::run()
    n= max(n, sockets[i]);
  n++;

  while (thread_registry.is_shutdown() == false)
  while (!thread_registry.is_shutdown())
  {
    fd_set read_fds_arg= read_fds;

@@ -149,8 +149,8 @@ void Listener_thread::run()
        /* accept may return -1 (failure or spurious wakeup) */
        if (client_fd >= 0)                    // connection established
        {
          Vio *vio = vio_new(client_fd, socket_index==0?VIO_TYPE_SOCKET:VIO_TYPE_TCPIP, 
            socket_index==0?1:0);
          Vio *vio = vio_new(client_fd, socket_index==0?VIO_TYPE_SOCKET:
                             VIO_TYPE_TCPIP, socket_index==0?1:0);
          if (vio != 0)
            handle_new_mysql_connection(vio);
          else
@@ -179,6 +179,10 @@ void Listener_thread::run()
  return;

err:
  // we have to close the ip sockets in case of error
  for (int i= 0; i < num_sockets; i++)
    close(sockets[i]);

  thread_registry.unregister_thread(&thread_info);
  thread_registry.request_shutdown();
  my_thread_end();
Loading