~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/drizzled.cc

  • Committer: Brian Aker
  • Date: 2009-09-22 07:35:28 UTC
  • mfrom: (971.6.10 eday-dev)
  • Revision ID: brian@gaz-20090922073528-xgm634aomuflqxl3
MergeĀ Eric

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
#include <drizzled/scheduling.h>
45
45
#include "drizzled/temporal_format.h" /* For init_temporal_formats() */
46
46
#include "drizzled/slot/listen.h"
 
47
#include "drizzled/plugin/client.h"
47
48
 
48
49
#include <google/protobuf/stubs/common.h>
49
50
 
224
225
static const char *default_character_set_name;
225
226
static const char *character_set_filesystem_name;
226
227
static char *lc_time_names_name;
227
 
static char *my_bind_addr_str;
228
228
static char *default_collation_name;
229
229
static char *default_storage_engine_str;
230
230
static const char *compiled_default_collation_name= "utf8_general_ci";
258
258
  requires a 4-byte integer.
259
259
*/
260
260
uint32_t drizzled_tcp_port;
261
 
 
262
 
uint32_t drizzled_port_timeout;
 
261
char *drizzled_bind_host;
 
262
uint32_t drizzled_bind_timeout;
263
263
std::bitset<12> test_flags;
264
264
uint32_t dropping_tables, ha_open_options;
265
265
uint32_t tc_heuristic_recover= 0;
394
394
drizzled::atomic<uint32_t> refresh_version;  /* Increments on each reload */
395
395
 
396
396
/* Function declarations */
397
 
bool drizzle_rm_tmp_tables(drizzled::slot::Listen &listen_handler);
 
397
bool drizzle_rm_tmp_tables(drizzled::slot::Listen &listen);
398
398
 
399
399
extern "C" pthread_handler_t signal_hand(void *arg);
400
400
static void drizzle_init_variables(void);
418
418
 
419
419
void close_connections(void)
420
420
{
 
421
  plugin::Registry &plugins= plugin::Registry::singleton();
 
422
 
421
423
  /* Abort listening to new connections */
422
 
  listen_abort();
 
424
  plugins.listen.shutdown();
423
425
 
424
426
  /* kill connection thread */
425
427
  (void) pthread_mutex_lock(&LOCK_thread_count);
488
490
    }
489
491
    tmp= session_list.front();
490
492
    (void) pthread_mutex_unlock(&LOCK_thread_count);
491
 
    tmp->protocol->forceClose();
 
493
    tmp->client->close();
492
494
  }
493
495
}
494
496
 
1489
1491
#endif
1490
1492
 
1491
1493
  plugin::Registry &plugins= plugin::Registry::singleton();
1492
 
  plugin::Protocol *protocol;
 
1494
  plugin::Client *client;
1493
1495
  Session *session;
1494
1496
 
1495
1497
  MY_INIT(argv[0]);             // init my_sys library & pthreads
1540
1542
 
1541
1543
  set_default_port();
1542
1544
 
1543
 
  if (plugins.listen.bindAll(my_bind_addr_str, drizzled_port_timeout))
 
1545
  if (plugins.listen.setup())
1544
1546
    unireg_abort(1);
1545
1547
 
1546
1548
  /*
1568
1570
 
1569
1571
 
1570
1572
  /* Listen for new connections and start new session for each connection
1571
 
     accepted. The listen.getProtocol() method will return NULL when the server
 
1573
     accepted. The listen.getClient() method will return NULL when the server
1572
1574
     should be shutdown. */
1573
 
  while ((protocol= plugins.listen.getProtocol()) != NULL)
 
1575
  while ((client= plugins.listen.getClient()) != NULL)
1574
1576
  {
1575
 
    if (!(session= new Session(protocol)))
 
1577
    if (!(session= new Session(client)))
1576
1578
    {
1577
 
      delete protocol;
 
1579
      delete client;
1578
1580
      continue;
1579
1581
    }
1580
1582
 
1699
1701
   (char**) &drizzle_home_ptr, (char**) &drizzle_home_ptr, 0, GET_STR, REQUIRED_ARG,
1700
1702
   0, 0, 0, 0, 0, 0},
1701
1703
  {"bind-address", OPT_BIND_ADDRESS, N_("IP address to bind to."),
1702
 
   (char**) &my_bind_addr_str, (char**) &my_bind_addr_str, 0, GET_STR,
 
1704
   (char**) &drizzled_bind_host, (char**) &drizzled_bind_host, 0, GET_STR,
1703
1705
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1704
1706
  {"chroot", 'r',
1705
1707
   N_("Chroot drizzled daemon during startup."),
1777
1779
  {"port-open-timeout", OPT_PORT_OPEN_TIMEOUT,
1778
1780
   N_("Maximum time in seconds to wait for the port to become free. "
1779
1781
      "(Default: no wait)"),
1780
 
   (char**) &drizzled_port_timeout,
1781
 
   (char**) &drizzled_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 
1782
   (char**) &drizzled_bind_timeout,
 
1783
   (char**) &drizzled_bind_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1782
1784
  {"secure-file-priv", OPT_SECURE_FILE_PRIV,
1783
1785
   N_("Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files "
1784
1786
      "within specified directory"),
2234
2236
  aborted_threads= aborted_connects= 0;
2235
2237
  max_used_connections= 0;
2236
2238
  drizzled_user= drizzled_chroot= 0;
2237
 
  my_bind_addr_str= NULL;
 
2239
  drizzled_bind_host= NULL;
2238
2240
  memset(&global_status_var, 0, sizeof(global_status_var));
2239
2241
  key_map_full.set();
2240
2242