Skip to content

Commit

Permalink
Merge branch 'master' into amend-pr-16
Browse files Browse the repository at this point in the history
  • Loading branch information
qinguoyi authored May 17, 2020
2 parents 3340d6e + 8ca30e8 commit ca34323
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions http/http_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ bool http_conn::write()
}
else
{
m_iv[0].iov_base = m_write_buf + bytes_to_send;
m_iv[0].iov_base = m_write_buf + bytes_have_send;
m_iv[0].iov_len = m_iv[0].iov_len - bytes_have_send;
}
modfd(m_epollfd, m_sockfd, EPOLLOUT, m_TRIGMode);
Expand Down Expand Up @@ -773,7 +773,7 @@ bool http_conn::add_response(const char *format, ...)
}
m_write_idx += len;
va_end(arg_list);

LOG_INFO("request:%s", m_write_buf);

return true;
Expand Down
2 changes: 1 addition & 1 deletion log/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ bool Log::init(const char *file_name, int close_log, int log_buf_size, int split
m_close_log = close_log;
m_log_buf_size = log_buf_size;
m_buf = new char[m_log_buf_size];
memset(m_buf, '\0', sizeof(m_buf));
memset(m_buf, '\0', m_log_buf_size);
m_split_lines = split_lines;

time_t t = time(NULL);
Expand Down
3 changes: 1 addition & 2 deletions log/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Log

static void *flush_log_thread(void *args)
{
return Log::get_instance()->async_write_log();
Log::get_instance()->async_write_log();
}
//可选择的参数有日志文件、日志缓冲区大小、最大行数以及最长日志条队列
bool init(const char *file_name, int close_log, int log_buf_size = 8192, int split_lines = 5000000, int max_queue_size = 0);
Expand All @@ -44,7 +44,6 @@ class Log
fputs(single_log.c_str(), m_fp);
m_mutex.unlock();
}
return nullptr;
}

private:
Expand Down
8 changes: 4 additions & 4 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
CXX ?= g++
CXXFLAGS = -Wall -Werror -Wextra

DEBUG ?= 1
ifeq ($(DEBUG), 1)
CXXFLAGS += -g -Ddebug
else
CXXFLAGS += -O2

endif

server: main.cpp ./timer/lst_timer.cpp ./http/http_conn.cpp ./log/log.cpp ./CGImysql/sql_connection_pool.cpp webserver.cpp config.cpp
$(CXX) -lmysqlclient -lpthread $^ $(CXXFLAGS) -o server
server: main.cpp ./timer/lst_timer.cpp ./http/http_conn.cpp ./log/log.cpp ./CGImysql/sql_connection_pool.cpp webserver.cpp config.cpp
$(CXX) -o server $^ $(CXXFLAGS) -lpthread -lmysqlclient

CGISQL.cgi:./CGImysql/sign.cpp
$(CXX) -o ./root/CGISQL.cgi ./CGImysql/sign.cpp -lmysqlclient -lpthread
g++ -o ./root/CGISQL.cgi $^ -lpthread -lmysqlclient

clean:
rm -r server
Expand Down
2 changes: 1 addition & 1 deletion raw_version/http/http_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ bool http_conn::write()
}
else
{
m_iv[0].iov_base = m_write_buf + bytes_to_send;
m_iv[0].iov_base = m_write_buf + bytes_have_send;
m_iv[0].iov_len = m_iv[0].iov_len - bytes_have_send;
}
modfd(m_epollfd, m_sockfd, EPOLLOUT);
Expand Down
2 changes: 1 addition & 1 deletion raw_version/log/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ bool Log::init(const char *file_name, int log_buf_size, int split_lines, int max

m_log_buf_size = log_buf_size;
m_buf = new char[m_log_buf_size];
memset(m_buf, '\0', sizeof(m_buf));
memset(m_buf, '\0', m_log_buf_size);
m_split_lines = split_lines;

time_t t = time(NULL);
Expand Down
Binary file removed root/CGISQL.cgi
Binary file not shown.

0 comments on commit ca34323

Please sign in to comment.