Skip to content

Commit

Permalink
[src] Modify all wrong spells and solve one FIXME
Browse files Browse the repository at this point in the history
  • Loading branch information
Sigma711 committed Jul 14, 2023
1 parent bae8c24 commit a76e7ad
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 22 deletions.
10 changes: 6 additions & 4 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<!-- taotu PR Template -->

### Purpose
<!-- Links to Design Docs, Github Issues or a few words about the purpose of this PR -->
#

## Purpose
<!-- Links to Design Docs, GitHub Issues or a few words about the purpose of this PR -->

- Purpose.

### Changes
## Changes
<!-- Major changes in this PR: -->

- No changes.

### Review Instructions
## Review Instructions
<!-- Please provide instructions about how should a reviewer test/verify the changes in this PR: -->

- No instructions.
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# The CMake configure and build commands are platform-agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion src/acceptor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Acceptor::Acceptor(Poller* poller, const NetAddress& listen_address,
accept_socketer_.BindAddress(listen_address);
accept_eventer_.RegisterReadCallback([this](const TimePoint& time_point) {
this->DoReading();
}); // Register the accepting action as an reading event handler
}); // Register the accepting action as a reading event handler
}
Acceptor::~Acceptor() {
LOG_DEBUG("Acceptor with fd(%d) is closing.", accept_socketer_.Fd());
Expand Down
13 changes: 7 additions & 6 deletions src/connecting.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,15 @@ void Connecting::ForceClose() {
DoClosing();
}
}

// FIXME: Make it be effective in the condition that the connection has been
// destroyed.
// void Connecting::ForceCloseAfter(int64_t delay_microseconds) {
// if (kDisconnected != state_) {
// event_manager_->RunAfter(delay_microseconds,
// std::bind(&Connecting::ForceClose, this));
// }
// }
void Connecting::ForceCloseAfter(int64_t delay_microseconds) {
if (kDisconnected != state_) {
event_manager_->RunAfter(delay_microseconds,
[this]() { this->ForceClose(); });
}
}

std::string Connecting::GetConnectionStateInfo(ConnectionState state) {
switch (state) {
Expand Down
9 changes: 5 additions & 4 deletions src/connecting.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ class Connecting : NonCopyableMovable {
// Be called when this connection establishing
void OnEstablishing();

// Send the message (asynchronously at most of time)
// Send the message (asynchronously at most time)
void Send(const void* message, size_t msg_len);

// Send the message (asynchronously at most of time)
// Send the message (asynchronously at most time)
void Send(const std::string& message);

// Send the message (asynchronously at most of time)
// Send the message (asynchronously at most time)
void Send(IoBuffer* io_buffer);

// Shut down the writing end (close half == stop writing indeed)
Expand All @@ -145,7 +145,8 @@ class Connecting : NonCopyableMovable {

// Close this TCP connection directly (at the end of this loop)
void ForceClose();
// FIXME: void ForceCloseAfter(int64_t delay_microseconds);

void ForceCloseAfter(int64_t delay_microseconds);

private:
enum ConnectionState {
Expand Down
2 changes: 1 addition & 1 deletion src/connector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void Connector::Connect() {
::close(sock_fd);
break;
default:
LOG_ERROR("Connector fd(%d) is closing because of an unkown error(%d)!!!",
LOG_ERROR("Connector fd(%d) is closing because of an unknow error(%d)!!!",
sock_fd, saved_errno);
::close(sock_fd);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/event_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class EventManager : NonCopyableMovable {

Poller* GetPoller() { return &poller_; }

// For the Balancer to pick a EventManager with lowest load
// For the Balancer to pick a EventManager with the lowest load
uint32_t GetEventerAmount() const {
LockGuard lock_guard(connection_map_mutex_lock_);
return connection_map_.size();
Expand Down
5 changes: 2 additions & 3 deletions src/reactor_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ void ServerReactorManager::AcceptNewConnectionCallback(
int socket_fd, const NetAddress& peer_address) {
auto new_connection = balancer_->PickOneEventManager()->InsertNewConnection(
socket_fd, GetLocalAddress(socket_fd),
peer_address); // Pick a "Reactor" with lowest load and
// insert the new
// connection created just now into it
peer_address); // Pick a "Reactor" with the lowest load and insert the
// new connection created just now into it
new_connection->RegisterOnConnectionCallback(ConnectionCallback_);
new_connection->RegisterOnMessageCallback(MessageCallback_);
new_connection->RegisterWriteCallback(WriteCompleteCallback_);
Expand Down
2 changes: 1 addition & 1 deletion src/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Timer : NonCopyableMovable {
// Register a time task
void AddTimeTask(const TimePoint& time_point, TimeCallback TimeTask);

// Get minium time duration for next epoll waiting
// Get minimum time duration for next epoll waiting
int GetMinTimeDuration() const;

// Get a set of expired time tasks
Expand Down

0 comments on commit a76e7ad

Please sign in to comment.