This commit is contained in:
root 2017-05-31 12:55:36 +08:00
parent 7d3de8e346
commit d91b82abfb
8 changed files with 13 additions and 64 deletions

View File

@ -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)
{

View File

@ -12,3 +12,4 @@
#include "lib_acl.h"
#include "acl_cpp/lib_acl.hpp"
#include "lib_protocol.h"

View File

@ -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*}

View File

@ -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

View File

@ -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();

View File

@ -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);

View File

@ -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

View File

@ -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;