ithewei 4 년 전
부모
커밋
5519edcb57
7개의 변경된 파일8개의 추가작업 그리고 13개의 파일을 삭제
  1. 4 1
      docs/PLAN.md
  2. 3 0
      evpp/EventLoop.h
  3. 1 0
      evpp/EventLoopThread.h
  4. 0 3
      evpp/TcpClient_test.cpp
  5. 0 3
      evpp/TcpServer_test.cpp
  6. 0 3
      evpp/UdpClient_test.cpp
  7. 0 3
      evpp/UdpServer_test.cpp

+ 4 - 1
docs/PLAN.md

@@ -7,7 +7,9 @@
 
 ## Improving
 
-- IOCP: fix bug, add SSL/TLS support
+- IOCP: fix bug, add SSL/TLS support, replace with wepoll?
+- wintls: SChannel is so hard :) need help
+- Path router: add filter chain, optimized matching via trie?
 
 ## Plan
 
@@ -17,3 +19,4 @@
 - js binding
 - hrpc = libhv + protobuf
 - reliable udp: FEC, ARQ, KCP, UDT, QUIC
+- have a taste of io_uring

+ 3 - 0
evpp/EventLoop.h

@@ -222,18 +222,21 @@ static inline EventLoop* tlsEventLoop() {
 
 static inline TimerID setTimer(int timeout_ms, TimerCallback cb, int repeat = INFINITE) {
     EventLoop* loop = tlsEventLoop();
+    assert(loop != NULL);
     if (loop == NULL) return INVALID_TIMER_ID;
     return loop->setTimer(timeout_ms, cb, repeat);
 }
 
 static inline void killTimer(TimerID timerID) {
     EventLoop* loop = tlsEventLoop();
+    assert(loop != NULL);
     if (loop == NULL) return;
     loop->killTimer(timerID);
 }
 
 static inline void resetTimer(TimerID timerID) {
     EventLoop* loop = tlsEventLoop();
+    assert(loop != NULL);
     if (loop == NULL) return;
     loop->resetTimer(timerID);
 }

+ 1 - 0
evpp/EventLoopThread.h

@@ -67,6 +67,7 @@ public:
         loop_->stop();
 
         if (wait_thread_stopped) {
+            if (hv_gettid() == loop_->tid()) return;
             while (!isStopped()) {
                 hv_delay(1);
             }

+ 0 - 3
evpp/TcpClient_test.cpp

@@ -45,9 +45,6 @@ int main(int argc, char* argv[]) {
     cli.onMessage = [](const SocketChannelPtr& channel, Buffer* buf) {
         printf("< %.*s\n", (int)buf->size(), (char*)buf->data());
     };
-    cli.onWriteComplete = [](const SocketChannelPtr& channel, Buffer* buf) {
-        printf("> %.*s\n", (int)buf->size(), (char*)buf->data());
-    };
     // reconnect: 1,2,4,8,10,10,10...
     ReconnectInfo reconn;
     reconn.min_delay = 1000;

+ 0 - 3
evpp/TcpServer_test.cpp

@@ -35,9 +35,6 @@ int main(int argc, char* argv[]) {
         printf("< %.*s\n", (int)buf->size(), (char*)buf->data());
         channel->write(buf);
     };
-    srv.onWriteComplete = [](const SocketChannelPtr& channel, Buffer* buf) {
-        printf("> %.*s\n", (int)buf->size(), (char*)buf->data());
-    };
     srv.setThreadNum(4);
     srv.start();
 

+ 0 - 3
evpp/UdpClient_test.cpp

@@ -26,9 +26,6 @@ int main(int argc, char* argv[]) {
     cli.onMessage = [](const SocketChannelPtr& channel, Buffer* buf) {
         printf("< %.*s\n", (int)buf->size(), (char*)buf->data());
     };
-    cli.onWriteComplete = [](const SocketChannelPtr& channel, Buffer* buf) {
-        printf("> %.*s\n", (int)buf->size(), (char*)buf->data());
-    };
     cli.start();
 
     // sendto(time) every 3s

+ 0 - 3
evpp/UdpServer_test.cpp

@@ -27,9 +27,6 @@ int main(int argc, char* argv[]) {
         printf("< %.*s\n", (int)buf->size(), (char*)buf->data());
         channel->write(buf);
     };
-    srv.onWriteComplete = [](const SocketChannelPtr& channel, Buffer* buf) {
-        printf("> %.*s\n", (int)buf->size(), (char*)buf->data());
-    };
     srv.start();
 
     while (1) hv_sleep(1);