ChipMaster's trial hacks on C++CMS starting with v1.2.1. Not sure I'll follow on with the v2 since it looks to be breaking and mostly frivolous.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

59 lines
1.7 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
  4. //
  5. // See accompanying file COPYING.TXT file for licensing details.
  6. //
  7. ///////////////////////////////////////////////////////////////////////////////
  8. #ifndef CPPCMS_PRIVATE_SESSION_TCP_STORAGE_H
  9. #define CPPCMS_PRIVATE_SESSION_TCP_STORAGE_H
  10. #include <cppcms/session_storage.h>
  11. #include <booster/thread.h>
  12. #include "tcp_connector.h"
  13. namespace cppcms {
  14. namespace sessions {
  15. class CPPCMS_API tcp_storage : public session_storage {
  16. public:
  17. tcp_storage(std::vector<std::string> const &ips,std::vector<int> const &ports) :
  18. ips_(ips),
  19. ports_(ports)
  20. {
  21. }
  22. virtual void save(std::string const &sid,time_t timeout,std::string const &in);
  23. virtual bool load(std::string const &sid,time_t &timeout,std::string &out);
  24. virtual void remove(std::string const &sid);
  25. virtual bool is_blocking();
  26. cppcms::impl::tcp_connector &tcp();
  27. private:
  28. booster::thread_specific_ptr<cppcms::impl::tcp_connector> tcp_;
  29. std::vector<std::string> ips_;
  30. std::vector<int> ports_;
  31. };
  32. class CPPCMS_API tcp_factory : public session_storage_factory {
  33. public:
  34. tcp_factory(std::vector<std::string> const &ips,std::vector<int> const &ports) :
  35. storage_(new tcp_storage(ips,ports))
  36. {
  37. }
  38. virtual booster::shared_ptr<session_storage> get()
  39. {
  40. return storage_;
  41. }
  42. virtual bool requires_gc()
  43. {
  44. return false;
  45. }
  46. virtual ~tcp_factory() {}
  47. private:
  48. booster::shared_ptr<session_storage> storage_;
  49. };
  50. } // sessions
  51. } // cppcms
  52. #endif