mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-30 02:47:56 +08:00
merge
This commit is contained in:
parent
7d3de8e346
commit
d91b82abfb
@ -2,13 +2,6 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <direct.h>
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define chdir _chdir
|
||||
#define getcwd _getcwd
|
||||
#endif // MSVC
|
||||
|
||||
static void create_files(const std::vector<std::string>& files)
|
||||
{
|
||||
|
@ -12,3 +12,4 @@
|
||||
|
||||
#include "lib_acl.h"
|
||||
#include "acl_cpp/lib_acl.hpp"
|
||||
#include "lib_protocol.h"
|
||||
|
@ -43,14 +43,6 @@ public:
|
||||
*/
|
||||
query& set_parameter(const char* name, const char *value);
|
||||
|
||||
/**
|
||||
* 设置字符串类型的变量值
|
||||
* @param name {const char*} 变量名
|
||||
* @param value {const char*} 变量值
|
||||
* @return {query&}
|
||||
*/
|
||||
query& set_parameter(const char* name, const std::string &value);
|
||||
|
||||
/**
|
||||
* 设置字符类型的变量值
|
||||
* @param name {const char*} 变量名
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
* @return {bool} 返回处理结果,返回 false 表示处理失败或处理成功且不保持
|
||||
* 长连接,应关闭连接
|
||||
*/
|
||||
virtual bool doRun();
|
||||
bool doRun();
|
||||
|
||||
/**
|
||||
* HttpServlet 对象开始运行,接收 HTTP 请求,并回调以下 doXXX 虚函数
|
||||
@ -111,7 +111,7 @@ public:
|
||||
* 的关闭情况,这样可以方便与 acl_master 架构结合
|
||||
* @return {bool} 返回处理结果
|
||||
*/
|
||||
virtual bool doRun(session& session, socket_stream* stream = NULL);
|
||||
bool doRun(session& session, socket_stream* stream = NULL);
|
||||
|
||||
/**
|
||||
* HttpServlet 对象开始运行,接收 HTTP 请求,并回调以下 doXXX 虚函数,
|
||||
@ -120,7 +120,7 @@ public:
|
||||
* @param stream {socket_stream*} 含义同上
|
||||
* @return {bool} 返回处理结果
|
||||
*/
|
||||
virtual bool doRun(const char* memcached_addr, socket_stream* stream);
|
||||
bool doRun(const char* memcached_addr, socket_stream* stream);
|
||||
|
||||
/**
|
||||
* 当 HTTP 请求为 GET 方式时调用的虚函数
|
||||
|
@ -118,7 +118,6 @@ private:
|
||||
|
||||
bool check_namespace();
|
||||
bool check_namespace_end();
|
||||
bool check_using_namespace();
|
||||
bool check_struct_begin ();
|
||||
bool check_struct_end ();
|
||||
bool check_include();
|
||||
|
@ -151,11 +151,6 @@ void query::del_param(const string& key)
|
||||
}
|
||||
}
|
||||
|
||||
query& query::set_parameter(const char* name, const std::string &value)
|
||||
{
|
||||
return set_parameter(name, value.c_str());
|
||||
}
|
||||
|
||||
query& query::set_parameter(const char* name, const char *value)
|
||||
{
|
||||
string key(name);
|
||||
|
@ -361,33 +361,25 @@ int websocket::read_frame_data(char* buf, size_t size)
|
||||
if (header_.payload_len - payload_nread_ < size)
|
||||
size = (size_t) (header_.payload_len - payload_nread_);
|
||||
|
||||
int bytes = 0;
|
||||
while (true)
|
||||
int ret = client_.read(buf, size, false);
|
||||
if (ret == -1)
|
||||
{
|
||||
int ret = client_.read(buf + bytes, size - bytes, false);
|
||||
if (ret == -1)
|
||||
{
|
||||
if (last_error() != ACL_ETIMEDOUT)
|
||||
logger_error("read frame data error: %d, %s",
|
||||
last_error(), last_serror());
|
||||
return -1;
|
||||
}
|
||||
bytes += ret;
|
||||
if (bytes == size)
|
||||
break;
|
||||
if (last_error() != ACL_ETIMEDOUT)
|
||||
logger_error("read frame data error: %d, %s",
|
||||
last_error(), last_serror());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (header_.mask)
|
||||
{
|
||||
unsigned char* mask = (unsigned char*) &header_.masking_key;
|
||||
for (int i = 0; i < bytes; i++)
|
||||
for (int i = 0; i < ret; i++)
|
||||
buf[i] ^= mask[i % 4];
|
||||
}
|
||||
|
||||
payload_nread_ += bytes;
|
||||
payload_nread_ += ret;
|
||||
|
||||
return bytes;
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace acl
|
||||
|
@ -553,26 +553,6 @@ again:
|
||||
return result;
|
||||
}
|
||||
|
||||
bool gsoner::check_using_namespace()
|
||||
{
|
||||
//
|
||||
using namespace std;
|
||||
std::string token = codes_.substr(pos_, strlen("using"));
|
||||
if (token == "using")
|
||||
{
|
||||
pos_ += (int)strlen("using");
|
||||
skip_space_comment();
|
||||
token = codes_.substr(pos_, strlen("namespace"));
|
||||
if (token != "namespace")
|
||||
throw syntax_error();
|
||||
pos_ += (int)strlen("namespace");
|
||||
skip_space_comment();
|
||||
token = next_token("; ");
|
||||
std::cout << "find using nameapace " << token << std::endl;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool gsoner::check_include()
|
||||
{
|
||||
std::string tmp = codes_.substr(pos_, strlen("#include"));
|
||||
@ -1354,9 +1334,6 @@ void gsoner::parse_code()
|
||||
continue;
|
||||
if(check_namespace_end())
|
||||
continue;
|
||||
case 'u':
|
||||
if(check_using_namespace())
|
||||
continue;
|
||||
case 'n':
|
||||
if(check_namespace())
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user