Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit bedf9ee
Author: astrozhou <[email protected]>
Date:   Tue Oct 22 17:50:34 2019 +0800

    Squashed commit of the following:

    commit 2ddc804
    Author: astrozhou <[email protected]>
    Date:   Tue Oct 22 17:34:40 2019 +0800

        add

    commit 8d87662
    Author: astrozhou <[email protected]>
    Date:   Tue Oct 22 17:34:15 2019 +0800

        uni jun

    commit 548a521
    Author: garryyan <[email protected]>
    Date:   Tue Oct 22 12:15:51 2019 +0800

        [windows]fix crash
  • Loading branch information
astrozhou committed Oct 23, 2019
1 parent 8b4cb93 commit 5bb7568
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions mars/stn/src/shortlink_task_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,13 @@ void ShortLinkTaskManager::__OnResponse(ShortLinkInterface* _worker, ErrCmdType

if(_worker->IsKeepAlive() && _conn_profile.socket_fd != INVALID_SOCKET) {
if(_err_type != kEctOK) {
close(_conn_profile.socket_fd);
socket_close(_conn_profile.socket_fd);
socket_pool_.Report(_conn_profile.is_reused_fd, false, false);
} else if(_conn_profile.ip_index >=0 && _conn_profile.ip_index < (int)_conn_profile.ip_items.size()) {
IPPortItem item = _conn_profile.ip_items[_conn_profile.ip_index];
CacheSocketItem cache_item(item, _conn_profile.socket_fd, _conn_profile.keepalive_timeout);
if(!socket_pool_.AddCache(cache_item)) {
close(cache_item.socket_fd);
socket_close(cache_item.socket_fd);
}
} else {
xassert2(false, "not match");
Expand Down
6 changes: 3 additions & 3 deletions mars/stn/src/socket_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace stn {
if(iter->IsSame(_item)) {
if(iter->HasTimeout() || _IsSocketClosed(iter->socket_fd)) {
xinfo2(TSF"remove timeout or closed socket, is timeout:%_", iter->HasTimeout());
close(iter->socket_fd);
socket_close(iter->socket_fd);
iter = socket_pool_.erase(iter);
continue;
}
Expand Down Expand Up @@ -103,7 +103,7 @@ namespace stn {
auto iter = socket_pool_.begin();
while(iter != socket_pool_.end()) {
if(iter->HasTimeout()) {
close(iter->socket_fd);
socket_close(iter->socket_fd);
xinfo2(TSF"remove timeout socket: ip:%_, port:%_, host:%_, fd:%_", iter->address_info.str_ip, iter->address_info.port, iter->address_info.str_host, iter->socket_fd);
iter = socket_pool_.erase(iter);
continue;
Expand All @@ -118,7 +118,7 @@ namespace stn {
xinfo2(TSF"clear cache sockets");
std::for_each(socket_pool_.begin(), socket_pool_.end(), [](CacheSocketItem& value) {
if(value.socket_fd != INVALID_SOCKET)
close(value.socket_fd);
socket_close(value.socket_fd);
});
socket_pool_.clear();
}
Expand Down

0 comments on commit 5bb7568

Please sign in to comment.