Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
an-tao committed Dec 7, 2018
1 parent a362989 commit e0addcc
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
1 change: 1 addition & 0 deletions trantor/net/EventLoop.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

// Taken from Muduo and modified
// Copyright 2016, Tao An. All rights reserved.
// https://github.com/an-tao/trantor
//
// Use of this source code is governed by a BSD-style license
// that can be found in the License file.
Expand Down
33 changes: 22 additions & 11 deletions trantor/net/TcpServer.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/**
*
* TcpServer.cc
* An Tao
*
* Copyright 2018, An Tao. All rights reserved.
* https://github.com/an-tao/trantor
* Use of this source code is governed by a BSD-style license
* that can be found in the License file.
*
* Trantor
*
*/
#include <trantor/net/TcpServer.h>
#include "Acceptor.h"
#include "inner/TcpConnectionImpl.h"
Expand Down Expand Up @@ -93,23 +106,21 @@ void TcpServer::start()
_started = true;
if (_idleTimeout > 0)
{
_timeingWheelMap[loop_] =
std::make_shared<TimingWheel>(loop_,
_idleTimeout,
1,
_idleTimeout < 500 ? _idleTimeout + 1 : 100);
_timeingWheelMap[loop_] = std::make_shared<TimingWheel>(loop_,
_idleTimeout,
1,
_idleTimeout < 500 ? _idleTimeout + 1 : 100);
if (loopPoolPtr_)
{
auto loopNum = loopPoolPtr_->getLoopNum();
while (loopNum > 0)
{
LOG_TRACE << "new Wheel loopNum=" << loopNum;
//LOG_TRACE << "new Wheel loopNum=" << loopNum;
auto poolLoop = loopPoolPtr_->getNextLoop();
_timeingWheelMap[poolLoop] =
std::make_shared<TimingWheel>(poolLoop,
_idleTimeout,
1,
_idleTimeout < 500 ? _idleTimeout + 1 : 100);
_timeingWheelMap[poolLoop] = std::make_shared<TimingWheel>(poolLoop,
_idleTimeout,
1,
_idleTimeout < 500 ? _idleTimeout + 1 : 100);
loopNum--;
}
}
Expand Down
13 changes: 13 additions & 0 deletions trantor/net/TcpServer.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/**
*
* TcpServer.h
* An Tao
*
* Copyright 2018, An Tao. All rights reserved.
* https://github.com/an-tao/trantor
* Use of this source code is governed by a BSD-style license
* that can be found in the License file.
*
* Trantor
*
*/
#pragma once
#include <trantor/utils/config.h>
#include <trantor/net/callbacks.h>
Expand Down

0 comments on commit e0addcc

Please sign in to comment.