~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Brian Aker
  • Date: 2010-12-23 20:54:14 UTC
  • mfrom: (2022.2.1 clean)
  • mto: (2026.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2025.
  • Revision ID: brian@tangent.org-20101223205414-2xvdkdp77t0rvutg
Merge in session list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
379
379
{
380
380
  this->checkSentry();
381
381
 
382
 
  if (client->isConnected())
 
382
  if (client and client->isConnected())
383
383
  {
384
384
    assert(security_ctx);
385
385
    if (global_system_variables.log_warnings)
390
390
                    security_ctx->username().c_str());
391
391
    }
392
392
 
393
 
    disconnect(0, false);
 
393
    disconnect();
394
394
  }
395
395
 
396
396
  /* Close connection */
397
 
  client->close();
398
 
  delete client;
 
397
  if (client)
 
398
  {
 
399
    client->close();
 
400
    delete client;
 
401
  }
399
402
 
400
403
  if (cleanup_done == false)
401
404
    cleanup();
537
540
{
538
541
  if (storeGlobals())
539
542
  {
540
 
    disconnect(ER_OUT_OF_RESOURCES, true);
 
543
    disconnect(ER_OUT_OF_RESOURCES);
541
544
    status_var.aborted_connects++;
542
545
    return true;
543
546
  }
548
551
{
549
552
  if (initGlobals() || authenticate())
550
553
  {
551
 
    disconnect(0, true);
 
554
    disconnect();
552
555
    return;
553
556
  }
554
557
 
560
563
      break;
561
564
  }
562
565
 
563
 
  disconnect(0, true);
 
566
  disconnect();
564
567
}
565
568
 
566
569
bool Session::schedule(Session::shared_ptr &arg)
610
613
/*
611
614
  Is this session viewable by the current user?
612
615
*/
613
 
bool Session::isViewable() const
 
616
bool Session::isViewable(identifier::User::const_reference user_arg) const
614
617
{
615
 
  return plugin::Authorization::isAuthorized(current_session->user(),
616
 
                                             this,
617
 
                                             false);
 
618
  return plugin::Authorization::isAuthorized(user_arg, this, false);
618
619
}
619
620
 
620
621
 
1651
1652
  }
1652
1653
}
1653
1654
 
1654
 
void Session::disconnect(uint32_t errcode, bool should_lock)
 
1655
void Session::disconnect(enum drizzled_error_code errcode)
1655
1656
{
1656
1657
  /* Allow any plugins to cleanup their session variables */
1657
1658
  plugin_sessionvar_cleanup(this);
1675
1676
    }
1676
1677
  }
1677
1678
 
1678
 
  /* Close out our connection to the client */
1679
 
  if (should_lock)
1680
 
    session::Cache::singleton().mutex().lock();
1681
 
 
1682
1679
  setKilled(Session::KILL_CONNECTION);
1683
1680
 
1684
1681
  if (client->isConnected())
1685
1682
  {
1686
 
    if (errcode)
 
1683
    if (errcode != EE_OK)
1687
1684
    {
1688
1685
      /*my_error(errcode, ER(errcode));*/
1689
1686
      client->sendError(errcode, ER(errcode));
1690
1687
    }
1691
1688
    client->close();
1692
1689
  }
1693
 
 
1694
 
  if (should_lock)
1695
 
  {
1696
 
    session::Cache::singleton().mutex().unlock();
1697
 
  }
1698
1690
}
1699
1691
 
1700
1692
void Session::reset_for_next_command()