mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralfms.git
synced 2026-01-05 19:41:26 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -271,7 +271,7 @@ namespace OpenWifi {
|
||||
std::string Answer;
|
||||
bool CloseConnection=false;
|
||||
if (Processor_ != nullptr) {
|
||||
Processor_->Processor(Obj, Answer, CloseConnection);
|
||||
Processor_->Processor(Obj, Answer, CloseConnection,Client->second->UserInfo_.userinfo);
|
||||
}
|
||||
if (!Answer.empty())
|
||||
Client->second->WS_->sendFrame(Answer.c_str(), (int)Answer.size());
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenWifi {
|
||||
|
||||
class UI_WebSocketClientProcessor {
|
||||
public:
|
||||
virtual void Processor(const Poco::JSON::Object::Ptr &O, std::string &Answer, bool &Done ) = 0;
|
||||
virtual void Processor(const Poco::JSON::Object::Ptr &O, std::string &Answer, bool &Done , const SecurityObjects::UserInfo & UserInfo) = 0;
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
@@ -483,6 +483,32 @@ namespace ORM {
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename... Args> bool GetRecordExt(RecordType & T , Args... args) {
|
||||
try {
|
||||
Poco::Data::Session Session = Pool_.get();
|
||||
Poco::Data::Statement Select(Session);
|
||||
RecordTuple RT;
|
||||
|
||||
auto WhereClause = WHERE_AND(args...);
|
||||
|
||||
std::string St = "select " + SelectFields_ + " from " + TableName_ + WhereClause + " limit 1";
|
||||
|
||||
Select << ConvertParams(St) ,
|
||||
Poco::Data::Keywords::into(RT);
|
||||
Select.execute();
|
||||
|
||||
if(Select.execute()==1) {
|
||||
Convert(RT,T);
|
||||
if(Cache_)
|
||||
Cache_->UpdateCache(T);
|
||||
return true;
|
||||
}
|
||||
} catch (const Poco::Exception &E) {
|
||||
Logger_.log(E);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef std::vector<std::string> StringVec;
|
||||
|
||||
template < typename T,
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <random>
|
||||
#include <regex>
|
||||
#include <thread>
|
||||
#include <shared_mutex>
|
||||
|
||||
#include "Poco/Thread.h"
|
||||
#include "Poco/StringTokenizer.h"
|
||||
@@ -128,6 +129,23 @@ namespace OpenWifi::Utils {
|
||||
<< std::hex << i;
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
inline bool SpinLock_Read(std::shared_mutex &M, volatile bool &Flag, uint64_t wait_ms=100) {
|
||||
while(!M.try_lock_shared() && Flag) {
|
||||
Poco::Thread::yield();
|
||||
Poco::Thread::trySleep((long)wait_ms);
|
||||
}
|
||||
return Flag;
|
||||
}
|
||||
|
||||
inline bool SpinLock_Write(std::shared_mutex &M, volatile bool &Flag, uint64_t wait_ms=100) {
|
||||
while(!M.try_lock() && Flag) {
|
||||
Poco::Thread::yield();
|
||||
Poco::Thread::trySleep(wait_ms);
|
||||
}
|
||||
return Flag;
|
||||
}
|
||||
|
||||
bool ExtractBase64CompressedData(const std::string &CompressedData,
|
||||
std::string &UnCompressedData, uint64_t compress_sz );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user