Skip to content

Commit

Permalink
!282 支持openssl
Browse files Browse the repository at this point in the history
1、引入wolfssl
2、删除crypt库
3、sqlite驱动完善
4、修复一些编译错误
5、https支持
  • Loading branch information
xiyoo0812 committed Apr 12, 2024
1 parent e1a8ea2 commit 7565dfa
Show file tree
Hide file tree
Showing 341 changed files with 1,284,070 additions and 4,218 deletions.
4 changes: 2 additions & 2 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ stds.quanta = {
"quanta", "environ", "signal", "service", "logger",
"import", "class", "enum", "mixin", "property", "singleton", "super", "implemented",
"logfeature", "db_property", "classof", "is_class", "is_subclass", "instanceof", "conv_class", "class_review",
"codec", "crypt", "stdfs", "luabus", "luakit", "json", "protobuf", "curl", "timer", "aoi", "log", "worker", "http", "bson", "detour",
"lmdb", "unqlite", "sqlite"
"codec", "stdfs", "luabus", "luakit", "json", "protobuf", "timer", "aoi", "log", "worker", "http", "bson",
"detour", "lmdb", "unqlite", "sqlite", "ssl"
}
}
std = "max+quanta"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ luaext:
cd extend/laoi; make SOLUTION_DIR=$(CUR_DIR) -f laoi.mak;
cd extend/lbson; make SOLUTION_DIR=$(CUR_DIR) -f lbson.mak;
cd extend/lcodec; make SOLUTION_DIR=$(CUR_DIR) -f lcodec.mak;
cd extend/lcrypt; make SOLUTION_DIR=$(CUR_DIR) -f lcrypt.mak;
cd extend/ldetour; make SOLUTION_DIR=$(CUR_DIR) -f ldetour.mak;
cd extend/ljson; make SOLUTION_DIR=$(CUR_DIR) -f ljson.mak;
cd extend/lmdb; make SOLUTION_DIR=$(CUR_DIR) -f lmdb.mak;
cd extend/lsqlite; make SOLUTION_DIR=$(CUR_DIR) -f lsqlite.mak;
cd extend/lssl; make SOLUTION_DIR=$(CUR_DIR) -f lssl.mak;
cd extend/lstdfs; make SOLUTION_DIR=$(CUR_DIR) -f lstdfs.mak;
cd extend/ltimer; make SOLUTION_DIR=$(CUR_DIR) -f ltimer.mak;
cd extend/lualog; make SOLUTION_DIR=$(CUR_DIR) -f lualog.mak;
Expand Down
2 changes: 2 additions & 0 deletions bin/template/share.conf
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ set_env("QUANTA_SANDBOX", "sandbox")
set_env("QUANTA_PROTO_FILE", "proto/ncmd_cs.pb")
--定义UNQLITE路径
set_env("QUANTA_UNQLITE_PATH", "./unqlite/")
--定义UNQLITE路径
set_env("QUANTA_SQLITE_PATH", "./sqlite/")
--定义LMDB路径
set_env("QUANTA_LMDB_PATH", "./lmdb/")

Expand Down
2 changes: 1 addition & 1 deletion core/luabus/src/lua_socket_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int lua_socket_node::call_data(lua_State* L) {
if (m_codec) {
size_t data_len = 0;
char* data = (char*)m_codec->encode(L, 1, &data_len);
if (data_len <= SOCKET_PACKET_MAX){
if (data_len > 0 && data_len <= SOCKET_PACKET_MAX){
m_mgr->send(m_token, data, data_len);
lua_pushinteger(L, data_len);
return 1;
Expand Down
9 changes: 4 additions & 5 deletions core/luabus/src/socket_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ void socket_stream::stream_send(const char* data, size_t data_len)
while (data_len > 0) {
int send_len = ::send(m_socket, data, (int)data_len, 0);
if (send_len == 0) {
on_error("connection-lost");
on_error("connection-send-lost");
return;
}
if (send_len == SOCKET_ERROR) {
Expand Down Expand Up @@ -369,7 +369,7 @@ void socket_stream::do_send(size_t max_len, bool is_eof) {
return;
}
if (send_len == 0) {
on_error("connection-lost");
on_error("connection-send-lost");
return;
}
total_send += send_len;
Expand All @@ -380,8 +380,7 @@ void socket_stream::do_send(size_t max_len, bool is_eof) {
}
}

void socket_stream::do_recv(size_t max_len, bool is_eof)
{
void socket_stream::do_recv(size_t max_len, bool is_eof) {
size_t total_recv = 0;
while (total_recv < max_len && m_link_status == elink_status::link_connected) {
auto* space = m_recv_buffer->peek_space(SOCKET_RECV_LEN);
Expand Down Expand Up @@ -412,7 +411,7 @@ void socket_stream::do_recv(size_t max_len, bool is_eof)
return;
}
if (recv_len == 0) {
on_error("connection-lost");
on_error("connection-recv-lost");
return;
}
total_recv += recv_len;
Expand Down
15 changes: 9 additions & 6 deletions extend/lcodec/src/http.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ namespace lcodec {

protected:
virtual void format_http(lua_State* L, int* index) = 0;
virtual void parse_http_packet(lua_State* L, string_view buf) = 0;
virtual void parse_http_packet(lua_State* L, string_view& buf) = 0;

void http_parse_body(lua_State* L, string_view header, string_view buf) {
void http_parse_body(lua_State* L, string_view header, string_view& buf) {
m_buf->clean();
bool jsonable = false;
bool contentlenable = false;
Expand Down Expand Up @@ -210,7 +210,7 @@ namespace lcodec {
}
}

virtual void parse_http_packet(lua_State* L, string_view buf) {
virtual void parse_http_packet(lua_State* L, string_view& buf) {
size_t pos = buf.find(CRLF2);
if (pos == string_view::npos) {
throw length_error("http text not full");
Expand Down Expand Up @@ -272,7 +272,7 @@ namespace lcodec {
m_buf->push_data((const uint8_t*)buf, len);
}

virtual void parse_http_packet(lua_State* L, string_view buf) {
virtual void parse_http_packet(lua_State* L, string_view& buf) {
size_t pos = buf.find(CRLF2);
if (pos == string_view::npos) {
throw length_error("http text not full");
Expand All @@ -285,9 +285,12 @@ namespace lcodec {
if (parts.size() < 2) {
throw lua_exception("invalid http header");
}
//proto
lua_pushstring(L, "HTTP");
//status
if (lua_stringtonumber(L, parts[1].data()) == 0) {
lua_pushlstring(L, parts[1].data(), parts[1].size());
string status = string(parts[1]);
if (lua_stringtonumber(L, status.c_str()) == 0) {
lua_pushlstring(L, status.c_str(), status.size());
}
//header + body
http_parse_body(L, header, buf);
Expand Down
31 changes: 0 additions & 31 deletions extend/lcrypt/lcrypt.lmak

This file was deleted.

134 changes: 0 additions & 134 deletions extend/lcrypt/lcrypt.mak

This file was deleted.

96 changes: 0 additions & 96 deletions extend/lcrypt/lcrypt.vcxproj

This file was deleted.

Loading

0 comments on commit 7565dfa

Please sign in to comment.