~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/main.cc

  • Committer: Monty Taylor
  • Date: 2010-12-22 06:53:38 UTC
  • mto: (2053.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2054.
  • Revision ID: mordred@inaugust.com-20101222065338-ek2nwm6ctq20d8np
Added an abort macro and an abort_exception.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
 
45
45
#include <boost/filesystem.hpp>
46
46
 
 
47
#include "drizzled/abort_exception.h"
47
48
#include "drizzled/plugin.h"
48
49
#include "drizzled/gettext.h"
49
50
#include "drizzled/configmake.h"
339
340
    }
340
341
  }
341
342
 
342
 
 
343
 
  /* Listen for new connections and start new session for each connection
344
 
     accepted. The listen.getClient() method will return NULL when the server
345
 
     should be shutdown. */
346
 
  while ((client= plugin::Listen::getClient()) != NULL)
 
343
  try
347
344
  {
348
 
    Session::shared_ptr session(new Session(client));
349
345
 
350
 
    if (not session)
 
346
    /* Listen for new connections and start new session for each connection
 
347
      accepted. The listen.getClient() method will return NULL when the server
 
348
      should be shutdown. */
 
349
    while ((client= plugin::Listen::getClient()) != NULL)
351
350
    {
352
 
      delete client;
353
 
      continue;
 
351
      Session::shared_ptr session(new Session(client));
 
352
 
 
353
      if (not session)
 
354
      {
 
355
        delete client;
 
356
        continue;
 
357
      }
 
358
 
 
359
      /* If we error on creation we drop the connection and delete the
 
360
        session. */
 
361
      if (Session::schedule(session))
 
362
        Session::unlink(session);
354
363
    }
355
364
 
356
 
    /* If we error on creation we drop the connection and delete the session. */
357
 
    if (Session::schedule(session))
358
 
      Session::unlink(session);
 
365
  }
 
366
  catch (abort_exception& ex)
 
367
  {
 
368
    cout << _("Drizzle has receieved an abort event.") << endl;
 
369
    cout << _("In Function: ") << *::boost::get_error_info<boost::throw_function>(ex) << endl;
 
370
    cout << _("In File: ") << *::boost::get_error_info<boost::throw_file>(ex) << endl;
 
371
    cout << _("On Line: ") << *::boost::get_error_info<boost::throw_line>(ex) << endl;
 
372
 
 
373
  }
 
374
  catch (std::exception& ex)
 
375
  {
 
376
    cout << _("Drizzle has recieved an unknown error, shutting down") << endl;
 
377
    cout << _("Error: ") << ex.what() << endl;
359
378
  }
360
379
 
361
380
  /* Send server shutdown event */