MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / run

Method run

base/poco/Net/src/TCPServer.cpp:126–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124
125
126void TCPServer::run()
127{
128 while (!_stopped)
129 {
130 Poco::Timespan timeout(250000);
131 try
132 {
133 if (_socket.poll(timeout, Socket::SELECT_READ))
134 {
135 try
136 {
137 StreamSocket ss = _socket.acceptConnection();
138
139 if (!_pConnectionFilter || _pConnectionFilter->accept(ss))
140 {
141 // enable nodelay per default: OSX really needs that
142#if defined(POCO_OS_FAMILY_UNIX)
143 if (ss.address().family() != AddressFamily::UNIX_LOCAL)
144#endif
145 {
146 ss.setNoDelay(_pDispatcher->params().getNoDelay());
147 }
148 _pDispatcher->enqueue(ss);
149 }
150 else
151 {
152 ErrorHandler::logMessage(Message::PRIO_WARNING, "Filtered out connection from " + ss.peerAddress().toString());
153 }
154 }
155 // Termination request
156 catch (Poco::InvalidArgumentException& exc)
157 {
158 ErrorHandler::logMessage(Message::PRIO_INFORMATION, "Shutting down TCPServer: " + exc.displayText());
159 }
160 catch (Poco::Exception& exc)
161 {
162 ErrorHandler::handle(exc);
163 }
164 catch (std::exception& exc)
165 {
166 ErrorHandler::handle(exc);
167 }
168 catch (...)
169 {
170 ErrorHandler::handle();
171 }
172 }
173 }
174 catch (Poco::Exception& exc)
175 {
176 ErrorHandler::handle(exc);
177 // possibly a resource issue since poll() failed;
178 // give some time to recover before trying again
179 Poco::Thread::sleep(50);
180 }
181 }
182}
183

Callers

nothing calls this directly

Calls 13

handleFunction · 0.85
displayTextMethod · 0.80
sleepFunction · 0.50
pollMethod · 0.45
acceptConnectionMethod · 0.45
acceptMethod · 0.45
familyMethod · 0.45
addressMethod · 0.45
setNoDelayMethod · 0.45
getNoDelayMethod · 0.45
enqueueMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected