Skip to content

Commit 7d6ca8e

Browse files
authored
Bump version to v1.0.0-rc3 (#41)
1 parent 994db27 commit 7d6ca8e

File tree

8 files changed

+79
-29
lines changed

8 files changed

+79
-29
lines changed

CMakeLists.txt

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ SET(trantor_sources
6767
trantor/net/inner/Socket.cc
6868
trantor/net/inner/TcpConnectionImpl.cc
6969
trantor/net/inner/Timer.cc
70-
trantor/net/inner/TimerQueue.cc)
70+
trantor/net/inner/TimerQueue.cc
71+
trantor/net/inner/poller/EpollPoller.cc
72+
trantor/net/inner/poller/KQueue.cc)
7173

7274
FIND_PACKAGE(OpenSSL)
7375
IF(OpenSSL_FOUND)
@@ -78,21 +80,6 @@ ELSE()
7880
SET(trantor_sources ${trantor_sources} trantor/net/ssl/SSLConnectionSkipped.cc)
7981
ENDIF()
8082

81-
IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
82-
SET(trantor_sources ${trantor_sources} ${PROJECT_SOURCE_DIR}/trantor/net/inner/poller/EpollPoller.cc)
83-
MESSAGE(STATUS "current platform: Linux ")
84-
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows")
85-
MESSAGE(FATAL_ERROR "Error: Currently does not support Windows")
86-
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
87-
SET(trantor_sources ${trantor_sources} ${PROJECT_SOURCE_DIR}/trantor/net/inner/poller/KQueue.cc)
88-
MESSAGE(STATUS "current platform: FreeBSD")
89-
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
90-
SET(trantor_sources ${trantor_sources} ${PROJECT_SOURCE_DIR}/trantor/net/inner/poller/KQueue.cc)
91-
MESSAGE(STATUS "current platform: MacOS")
92-
ELSE ()
93-
MESSAGE(STATUS "other platform: ${CMAKE_SYSTEM_NAME}")
94-
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Linux")
95-
9683
ADD_LIBRARY(trantor ${trantor_sources})
9784
SET_PROPERTY(TARGET trantor PROPERTY CXX_STANDARD 14)
9885
SET_PROPERTY(TARGET trantor PROPERTY CXX_STANDARD_REQUIRED ON)

ChangeLog.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file.
33

44
## [Unreleased]
55

6+
## [1.0.0-rc3] - 2019-07-30
7+
8+
### API change list
9+
10+
- TcpConnection::setContext, TcpConnection::getContext, etc.
11+
- Remove the config.h from public API.
12+
13+
### Changed
14+
15+
- Modify the CMakeLists.txt.
16+
- Modify some log output.
17+
- Remove some unnecessary `std::dynamic_pointer_cast` calls.
18+
619
## [1.0.0-rc2] - 2019-07-11
720

821
### Added
@@ -17,7 +30,9 @@ All notable changes to this project will be documented in this file.
1730

1831
## [1.0.0-rc1] - 2019-06-11
1932

20-
[Unreleased]: https://github.com/an-tao/trantor/compare/v1.0.0-rc2...HEAD
33+
[Unreleased]: https://github.com/an-tao/trantor/compare/v1.0.0-rc3...HEAD
34+
35+
[1.0.0-rc3]: https://github.com/an-tao/trantor/compare/v1.0.0-rc2...v1.0.0-rc3
2136

2237
[1.0.0-rc2]: https://github.com/an-tao/trantor/compare/v1.0.0-rc1...v1.0.0-rc2
2338

trantor/net/TcpConnection.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ class TcpConnection
7979
{
8080
return (bool)_contextPtr;
8181
}
82-
82+
8383
/// Clear the context.
8484
void clearContext()
8585
{
8686
_contextPtr.reset();
8787
}
88-
88+
8989
// Call this method to avoid being kicked off by TcpServer, refer to
9090
// the kickoffIdleConnections method in the TcpServer class.
9191
virtual void keepAlive() = 0;

trantor/net/inner/poller/EpollPoller.cc

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@
1515
#include <trantor/utils/Logger.h>
1616
#include "Channel.h"
1717
#include "EpollPoller.h"
18+
#ifdef __linux__
1819
#include <poll.h>
1920
#include <sys/epoll.h>
2021
#include <unistd.h>
2122
#include <assert.h>
2223
#include <strings.h>
2324
#include <iostream>
24-
25+
#endif
2526
namespace trantor
2627
{
28+
#ifdef __linux__
2729
static_assert(EPOLLIN == POLLIN, "EPOLLIN != POLLIN");
2830
static_assert(EPOLLPRI == POLLPRI, "EPOLLPRI != POLLPRI");
2931
static_assert(EPOLLOUT == POLLOUT, "EPOLLOUT != POLLOUT");
@@ -185,5 +187,22 @@ void EpollPoller::update(int operation, Channel *channel)
185187
}
186188
}
187189
}
188-
190+
#else
191+
EpollPoller::EpollPoller(EventLoop *loop) : Poller(loop)
192+
{
193+
assert(false);
194+
}
195+
EpollPoller::~EpollPoller()
196+
{
197+
}
198+
void EpollPoller::poll(int timeoutMs, ChannelList *activeChannels)
199+
{
200+
}
201+
void EpollPoller::updateChannel(Channel *channel)
202+
{
203+
}
204+
void EpollPoller::removeChannel(Channel *channel)
205+
{
206+
}
207+
#endif
189208
} // namespace trantor

trantor/net/inner/poller/EpollPoller.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
#include <trantor/utils/NonCopyable.h>
1919
#include <trantor/net/EventLoop.h>
2020

21+
#ifdef __linux__
2122
#include <memory>
2223
#include <map>
2324
typedef std::vector<struct epoll_event> EventList;
24-
25+
#endif
2526
namespace trantor
2627
{
2728
class Channel;
@@ -36,6 +37,7 @@ class EpollPoller : public Poller
3637
virtual void removeChannel(Channel *channel) override;
3738

3839
private:
40+
#ifdef __linux__
3941
static const int kInitEventListSize = 16;
4042
int _epollfd;
4143
EventList _events;
@@ -45,5 +47,6 @@ class EpollPoller : public Poller
4547
ChannelMap _channels;
4648
#endif
4749
void fillActiveChannels(int numEvents, ChannelList *activeChannels) const;
50+
#endif
4851
};
4952
} // namespace trantor

trantor/net/inner/poller/KQueue.cc

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#include "KQueue.h"
22
#include "Channel.h"
3+
#ifdef USE_KQUEUE
34
#include <trantor/utils/Logger.h>
45
#include <sys/types.h>
56
#include <sys/event.h>
67
#include <sys/time.h>
78
#include <unistd.h>
89
#include <poll.h>
9-
10+
#endif
1011
namespace trantor
1112
{
13+
#ifdef USE_KQUEUE
1214
namespace
1315
{
1416
const int kNew = -1;
@@ -223,5 +225,25 @@ void KQueue::update(Channel *channel)
223225
}
224226
kevent(_kqfd, ev, n, NULL, 0, NULL);
225227
}
226-
228+
#else
229+
KQueue::KQueue(EventLoop *loop) : Poller(loop)
230+
{
231+
assert(false);
232+
}
233+
KQueue::~KQueue()
234+
{
235+
}
236+
void KQueue::poll(int timeoutMs, ChannelList *activeChannels)
237+
{
238+
}
239+
void KQueue::updateChannel(Channel *channel)
240+
{
241+
}
242+
void KQueue::removeChannel(Channel *channel)
243+
{
244+
}
245+
void KQueue::resetAfterFork()
246+
{
247+
}
248+
#endif
227249
} // namespace trantor

trantor/net/inner/poller/KQueue.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
#include <trantor/utils/NonCopyable.h>
1818
#include <trantor/net/EventLoop.h>
1919

20+
#if (defined(__unix__) && !defined(__linux__)) || \
21+
(defined(__APPLE__) && defined(__MACH__))
22+
#define USE_KQUEUE
2023
#include <memory>
2124
#include <unordered_map>
2225
#include <vector>
23-
2426
typedef std::vector<struct kevent> EventList;
25-
27+
#endif
2628
namespace trantor
2729
{
2830
class Channel;
@@ -38,6 +40,7 @@ class KQueue : public Poller
3840
virtual void resetAfterFork() override;
3941

4042
private:
43+
#ifdef USE_KQUEUE
4144
static const int kInitEventListSize = 16;
4245
int _kqfd;
4346
EventList _events;
@@ -46,6 +49,7 @@ class KQueue : public Poller
4649

4750
void fillActiveChannels(int numEvents, ChannelList *activeChannels) const;
4851
void update(Channel *channel);
52+
#endif
4953
};
5054

5155
} // namespace trantor

trantor/net/ssl/SSLConnectionSkipped.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class SSLConn
3131

3232
void initOpenSSL()
3333
{
34-
LOG_FATAL << "SSL is not supported!";
34+
LOG_FATAL << "SSL is not supported due to not being compiled with OpenSSL!";
3535
exit(1);
3636
}
3737
std::shared_ptr<SSLContext> newSSLContext()
@@ -42,7 +42,7 @@ void initServerSSLContext(const std::shared_ptr<SSLContext> &ctx,
4242
const std::string &certPath,
4343
const std::string &keyPath)
4444
{
45-
LOG_FATAL << "SSL is not supported!";
45+
LOG_FATAL << "SSL is not supported due to not being compiled with OpenSSL!";
4646
exit(1);
4747
}
4848
} // namespace trantor
@@ -55,7 +55,7 @@ SSLConnection::SSLConnection(EventLoop *loop,
5555
bool isServer)
5656
: TcpConnectionImpl(loop, socketfd, localAddr, peerAddr)
5757
{
58-
LOG_FATAL << "SSL is not supported!";
58+
LOG_FATAL << "SSL is not supported due to not being compiled with OpenSSL!";
5959
exit(1);
6060
}
6161

0 commit comments

Comments
 (0)