diff options
author | Arne H Juul <arnej@yahoo-inc.com> | 2017-03-13 13:52:58 +0100 |
---|---|---|
committer | Arne H Juul <arnej@yahoo-inc.com> | 2017-03-13 15:28:29 +0100 |
commit | a23d7d3af0ceb2c28ccc878a8f953c8c591b3b8a (patch) | |
tree | add02a89be59ffbabaf938f29f96fafc0c9110ae /fnet/src/tests | |
parent | 720617cf9e441059558870525cfefe94a85df788 (diff) |
perform async connect in same thread
* always set socket non-blocking in Init() before calling Connect()
* pick up async connect result in HandleWriteEvent
* also revert "set incoming connections in non-blocking mode"
since that is now always done in Init()
* revert "closed while not added to event loop" handling
(there is no longer a window where a connection can be
closed before it is added to the transport event loop)
* remove component for separate connect thread
Diffstat (limited to 'fnet/src/tests')
-rw-r--r-- | fnet/src/tests/connect_thread/.gitignore | 1 | ||||
-rw-r--r-- | fnet/src/tests/connect_thread/CMakeLists.txt | 8 | ||||
-rw-r--r-- | fnet/src/tests/connect_thread/connect_thread_test.cpp | 27 | ||||
-rw-r--r-- | fnet/src/tests/info/info.cpp | 2 |
4 files changed, 1 insertions, 37 deletions
diff --git a/fnet/src/tests/connect_thread/.gitignore b/fnet/src/tests/connect_thread/.gitignore deleted file mode 100644 index 66bba07002d..00000000000 --- a/fnet/src/tests/connect_thread/.gitignore +++ /dev/null @@ -1 +0,0 @@ -fnet_connect_thread_test_app diff --git a/fnet/src/tests/connect_thread/CMakeLists.txt b/fnet/src/tests/connect_thread/CMakeLists.txt deleted file mode 100644 index 337ab336a7b..00000000000 --- a/fnet/src/tests/connect_thread/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_executable(fnet_connect_thread_test_app TEST - SOURCES - connect_thread_test.cpp - DEPENDS - fnet -) -vespa_add_test(NAME fnet_connect_thread_test_app COMMAND fnet_connect_thread_test_app) diff --git a/fnet/src/tests/connect_thread/connect_thread_test.cpp b/fnet/src/tests/connect_thread/connect_thread_test.cpp deleted file mode 100644 index b5304cf9b9e..00000000000 --- a/fnet/src/tests/connect_thread/connect_thread_test.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include <vespa/vespalib/testkit/test_kit.h> -#include <vespa/fnet/connect_thread.h> -#include <vespa/fnet/ext_connectable.h> - -struct MyConn : public fnet::ExtConnectable { - bool connected = false; - void ext_connect() override { connected = true; } -}; - -TEST("require that connect thread will connect stuff") { - std::vector<MyConn> conns(5); - { - fnet::ConnectThread thread; - thread.connect_later(&conns[0]); - thread.connect_later(&conns[2]); - thread.connect_later(&conns[4]); - } - EXPECT_TRUE(conns[0].connected); - EXPECT_TRUE(!conns[1].connected); - EXPECT_TRUE(conns[2].connected); - EXPECT_TRUE(!conns[3].connected); - EXPECT_TRUE(conns[4].connected); -} - -TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/fnet/src/tests/info/info.cpp b/fnet/src/tests/info/info.cpp index 12320427053..16d9d548ebf 100644 --- a/fnet/src/tests/info/info.cpp +++ b/fnet/src/tests/info/info.cpp @@ -73,7 +73,7 @@ TEST("size of important objects") EXPECT_EQUAL(184u, sizeof(FNET_IOComponent)); EXPECT_EQUAL(32u, sizeof(FNET_Channel)); EXPECT_EQUAL(40u, sizeof(FNET_PacketQueue_NoLock)); - EXPECT_EQUAL(480u, sizeof(FNET_Connection)); + EXPECT_EQUAL(472u, sizeof(FNET_Connection)); EXPECT_EQUAL(96u, sizeof(FastOS_Cond)); EXPECT_EQUAL(56u, sizeof(FNET_DataBuffer)); EXPECT_EQUAL(24u, sizeof(FastOS_Time)); |