Skip to content

Commit

Permalink
revert , format
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Apr 8, 2024
1 parent b2fe971 commit 993bcdb
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 25 deletions.
1 change: 0 additions & 1 deletion scripts/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ COMPILE_PARAMS="--enable-openssl \
--enable-cares \
--enable-swoole-pgsql \
--enable-swoole-thread \
--enable-trace-log \
--with-swoole-odbc=unixODBC,/usr \
--enable-swoole-sqlite"

Expand Down
2 changes: 1 addition & 1 deletion src/core/base64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ size_t base64_decode(const char *in, size_t inlen, char *out) {
return j;
}

}
} // namespace swoole
4 changes: 2 additions & 2 deletions src/core/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,11 @@ void Logger::put(int level, const char *content, size_t length) {

n = sw_snprintf(log_str,
SW_LOG_BUFFER_SIZE,
"[%.*s %c%ld.%d]\t%s\t%.*s\n",
"[%.*s %c%d.%d]\t%s\t%.*s\n",
static_cast<int>(l_data_str),
date_str,
process_flag,
pthread_self(),
SwooleG.pid,
process_id,
level_str,
static_cast<int>(length),
Expand Down
13 changes: 10 additions & 3 deletions src/core/string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ ssize_t String::split(const char *delimiter, size_t delimiter_length, const Stri
off_t _offset = offset;
size_t ret;

swoole_trace_log(SW_TRACE_EOF_PROTOCOL, "#[0] count=%d, length=%ld, size=%ld, offset=%jd", count, length, size, (intmax_t) offset);
swoole_trace_log(SW_TRACE_EOF_PROTOCOL,
"#[0] count=%d, length=%ld, size=%ld, offset=%jd",
count,
length,
size,
(intmax_t) offset);

while (delimiter_addr) {
size_t _length = delimiter_addr - start_addr + delimiter_length;
Expand All @@ -207,9 +212,11 @@ ssize_t String::split(const char *delimiter, size_t delimiter_length, const Stri

ret = start_addr - str - _offset;
if (ret > 0 && ret < length) {
swoole_trace_log(SW_TRACE_EOF_PROTOCOL, "#[5] count=%d, remaining_length=%zu", count, (size_t) (length - offset));
swoole_trace_log(
SW_TRACE_EOF_PROTOCOL, "#[5] count=%d, remaining_length=%zu", count, (size_t) (length - offset));
} else if (ret >= length) {
swoole_trace_log(SW_TRACE_EOF_PROTOCOL, "#[3] length=%ld, size=%zu, offset=%jd", length, size, (intmax_t) offset);
swoole_trace_log(
SW_TRACE_EOF_PROTOCOL, "#[3] length=%ld, size=%zu, offset=%jd", length, size, (intmax_t) offset);
}

return ret;
Expand Down
1 change: 0 additions & 1 deletion src/os/msg_queue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ bool MsgQueue::push(QueueNode *in, size_t mdata_length) {
}
swoole_set_last_error(errno);
break;

}
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/os/process_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ static int ProcessPool_worker_loop_with_task_protocol(ProcessPool *pool, Worker
continue;
}

if (n != (ssize_t)(out.buf.info.len + sizeof(out.buf.info))) {
if (n != (ssize_t) (out.buf.info.len + sizeof(out.buf.info))) {
swoole_warning("bad task packet, The received data-length[%ld] is inconsistent with the packet-length[%ld]",
n,
out.buf.info.len + sizeof(out.buf.info));
Expand Down
5 changes: 2 additions & 3 deletions src/os/unix_socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
#include "swoole_socket.h"

namespace swoole {
UnixSocket::UnixSocket(bool blocking, int _protocol) :
SocketPair(blocking), protocol_(_protocol) {
UnixSocket::UnixSocket(bool blocking, int _protocol) : SocketPair(blocking), protocol_(_protocol) {
if (socketpair(AF_UNIX, protocol_, 0, socks) < 0) {
swoole_sys_warning("socketpair() failed");
return;
Expand All @@ -39,4 +38,4 @@ bool UnixSocket::set_buffer_size(size_t _size) {
}
return true;
}
}
} // namespace swoole
18 changes: 10 additions & 8 deletions src/server/base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,11 @@ bool BaseFactory::end(SessionId session_id, int flags) {
}

if (server_->if_forward_message(session)) {
swoole_trace_log(SW_TRACE_SERVER, "session_id=%ld, fd=%d, session->reactor_id=%d",
session_id,
session->fd,
session->reactor_id);
swoole_trace_log(SW_TRACE_SERVER,
"session_id=%ld, fd=%d, session->reactor_id=%d",
session_id,
session->fd,
session->reactor_id);
Worker *worker = server_->get_worker(session->reactor_id);
if (worker->pipe_master->send_async((const char *) &_send.info, sizeof(_send.info)) < 0) {
swoole_sys_warning("failed to send %lu bytes to pipe_master", sizeof(_send.info));
Expand Down Expand Up @@ -215,10 +216,11 @@ bool BaseFactory::finish(SendData *data) {

Session *session = server_->get_session(session_id);
if (server_->if_forward_message(session)) {
swoole_trace_log(SW_TRACE_SERVER, "session_id=%ld, fd=%d, session->reactor_id=%d",
session_id,
session->fd,
session->reactor_id);
swoole_trace_log(SW_TRACE_SERVER,
"session_id=%ld, fd=%d, session->reactor_id=%d",
session_id,
session->fd,
session->reactor_id);
Worker *worker = server_->gs->event_workers.get_worker(session->reactor_id);
EventData proxy_msg{};

Expand Down
10 changes: 5 additions & 5 deletions src/server/thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void ThreadFactory::spawn_event_worker(int i) {
Worker *worker = server_->get_worker(i);
g_worker_instance = worker;
worker->type = SW_PROCESS_EVENTWORKER;
server_->worker_thread_start([=](void) -> void { Server::reactor_thread_main_loop(server_, i); });
server_->worker_thread_start([=]() { Server::reactor_thread_main_loop(server_, i); });
at_thread_exit(worker);
});
}
Expand All @@ -91,8 +91,8 @@ void ThreadFactory::spawn_task_worker(int i) {
swoole_set_thread_id(i);
Worker *worker = server_->get_worker(i);
worker->type = SW_PROCESS_TASKWORKER;
server_->worker_thread_start(
[=](void) { server_->gs->task_workers.main_loop(&server_->gs->task_workers, worker); });
auto pool = &server_->gs->task_workers;
server_->worker_thread_start([=]() { pool->main_loop(pool, worker); });
at_thread_exit(worker);
});
}
Expand All @@ -105,7 +105,7 @@ void ThreadFactory::spawn_user_worker(int i) {
swoole_set_process_id(i);
swoole_set_thread_id(i);
worker->type = SW_PROCESS_USERWORKER;
server_->worker_thread_start([=](void) { server_->onUserWorkerStart(server_, worker); });
server_->worker_thread_start([=]() { server_->onUserWorkerStart(server_, worker); });
at_thread_exit(worker);
});
}
Expand All @@ -118,7 +118,7 @@ void ThreadFactory::spawn_manager_thread(int i) {
swoole_set_thread_id(i);
manager.id = i;
manager.type = SW_PROCESS_MANAGER;
server_->worker_thread_start([=](void) {
server_->worker_thread_start([=]() {
if (server_->onManagerStart) {
server_->onManagerStart(server_);
}
Expand Down

0 comments on commit 993bcdb

Please sign in to comment.