@@ -22,9 +22,8 @@ namespace OpenWifi {
2222
2323 class StorageClass : public SubSystemServer {
2424 public:
25- StorageClass () noexcept : SubSystemServer(" StorageClass" , " STORAGE-SVR" , " storage" ) {}
2625
27- int Start () override {
26+ inline int Start () override {
2827 std::lock_guard Guard (Mutex_);
2928
3029 Logger ().notice (" Starting." );
@@ -40,17 +39,22 @@ namespace OpenWifi {
4039 return 0 ;
4140 }
4241
43- void Stop () override { Pool_->shutdown (); }
42+ inline void Stop () override { Pool_->shutdown (); }
4443
4544 DBType Type () const { return dbType_; };
4645
46+ StorageClass () noexcept : SubSystemServer(" StorageClass" , " STORAGE-SVR" , " storage" ) {
47+
48+ }
49+
4750 private:
4851 inline int Setup_SQLite ();
4952 inline int Setup_MySQL ();
5053 inline int Setup_PostgreSQL ();
5154
52- protected:
53- std::unique_ptr<Poco::Data::SessionPool> Pool_;
55+
56+ protected:
57+ std::shared_ptr<Poco::Data::SessionPool> Pool_;
5458 Poco::Data::SQLite::Connector SQLiteConn_;
5559 Poco::Data::PostgreSQL::Connector PostgresConn_;
5660 Poco::Data::MySQL::Connector MySQLConn_;
@@ -81,7 +85,7 @@ namespace OpenWifi {
8185 // Poco::Data::SessionPool(SQLiteConn_.name(), DBName, 8,
8286 // (int)NumSessions,
8387 // (int)IdleTime));
84- Pool_ = std::make_unique <Poco::Data::SessionPool>(SQLiteConn_.name (), DBName, 8 ,
88+ Pool_ = std::make_shared <Poco::Data::SessionPool>(SQLiteConn_.name (), DBName, 8 ,
8589 (int )NumSessions, (int )IdleTime);
8690 return 0 ;
8791 }
@@ -102,7 +106,7 @@ namespace OpenWifi {
102106 " ;compress=true;auto-reconnect=true" ;
103107
104108 Poco::Data::MySQL::Connector::registerConnector ();
105- Pool_ = std::make_unique <Poco::Data::SessionPool>(MySQLConn_.name (), ConnectionStr, 8 ,
109+ Pool_ = std::make_shared <Poco::Data::SessionPool>(MySQLConn_.name (), ConnectionStr, 8 ,
106110 NumSessions, IdleTime);
107111
108112 return 0 ;
@@ -126,7 +130,7 @@ namespace OpenWifi {
126130 " connect_timeout=" + ConnectionTimeout;
127131
128132 Poco::Data::PostgreSQL::Connector::registerConnector ();
129- Pool_ = std::make_unique <Poco::Data::SessionPool>(PostgresConn_.name (), ConnectionStr, 8 ,
133+ Pool_ = std::make_shared <Poco::Data::SessionPool>(PostgresConn_.name (), ConnectionStr, 8 ,
130134 NumSessions, IdleTime);
131135
132136 return 0 ;
0 commit comments