MCPcopy Create free account
hub / github.com/chen3feng/toft / IoThread

Method IoThread

system/net/socket_test.cpp:130–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128
129private:
130 void IoThread()
131 {
132 StreamSocket acceptor;
133 EXPECT_TRUE(m_listener.Accept(&acceptor));
134 SocketAddressInet peer_address;
135 EXPECT_TRUE(acceptor.GetPeerAddress(&peer_address));
136#if __unix__
137 int keep_alive;
138 int idle;
139 int interval;
140 int count;
141 EXPECT_TRUE(acceptor.SetTcpKeepAliveOption(14400, 150, 5));
142 EXPECT_TRUE(acceptor.GetOption(SOL_SOCKET, SO_KEEPALIVE, &keep_alive));
143 EXPECT_EQ(1, keep_alive);
144 EXPECT_TRUE(acceptor.GetOption(SOL_TCP, TCP_KEEPIDLE, &idle));
145 EXPECT_EQ(14400, idle);
146 EXPECT_TRUE(acceptor.GetOption(SOL_TCP, TCP_KEEPINTVL, &interval));
147 EXPECT_EQ(150, interval);
148 EXPECT_TRUE(acceptor.GetOption(SOL_TCP, TCP_KEEPCNT, &count));
149 EXPECT_EQ(5, count);
150#endif
151 std::string line;
152 while (acceptor.ReceiveLine(&line) && !line.empty())
153 {
154 acceptor.SendAll(line.data(), line.size());
155 }
156 }
157
158protected:
159 ListenerSocket m_listener;

Callers

nothing calls this directly

Calls 9

AcceptMethod · 0.80
GetPeerAddressMethod · 0.80
SetTcpKeepAliveOptionMethod · 0.80
GetOptionMethod · 0.80
ReceiveLineMethod · 0.80
SendAllMethod · 0.80
dataMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected