MCPcopy Create free account
hub / github.com/apache/thrift / isOpen

Method isOpen

lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp:158–623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158bool TNonblockingServerSocket::isOpen() const {
159 if (serverSocket_ == THRIFT_INVALID_SOCKET)
160 return false;
161
162 if (!listening_)
163 return false;
164
165 if (isUnixDomainSocket() && (path_[0] != '\0')) {
166 // On some platforms the domain socket file may not be instantly
167 // available yet, i.e. the Windows file system can be slow. Therefore
168 // we should check that the domain socket file actually exists.
169#ifdef _MSC_VER
170 // Currently there is a bug in ClangCl on Windows so the stat() call
171 // does not work. Workaround is a Windows-specific call if file exists:
172 DWORD const f_attrib = GetFileAttributesA(path_.c_str());
173 if (f_attrib == INVALID_FILE_ATTRIBUTES) {
174#else
175 struct THRIFT_STAT path_info;
176 if (::THRIFT_STAT(path_.c_str(), &path_info) < 0) {
177#endif
178 const std::string vError = "TNonblockingServerSocket::isOpen(): The domain socket path '" + path_ + "' does not exist (yet).";
179 TOutput::instance().perror(vError.c_str(), THRIFT_GET_SOCKET_ERROR);
180 return false;
181 }
182 }
183
184 return true;
185}
186
187void TNonblockingServerSocket::setSendTimeout(int sendTimeout) {
188 sendTimeout_ = sendTimeout;
189}
190
191void TNonblockingServerSocket::setRecvTimeout(int recvTimeout) {
192 recvTimeout_ = recvTimeout;
193}
194
195void TNonblockingServerSocket::setAcceptBacklog(int accBacklog) {
196 acceptBacklog_ = accBacklog;
197}
198
199void TNonblockingServerSocket::setRetryLimit(int retryLimit) {
200 retryLimit_ = retryLimit;
201}
202
203void TNonblockingServerSocket::setRetryDelay(int retryDelay) {
204 retryDelay_ = retryDelay;
205}
206
207void TNonblockingServerSocket::setTcpSendBuffer(int tcpSendBuffer) {
208 tcpSendBuffer_ = tcpSendBuffer;
209}
210
211void TNonblockingServerSocket::setTcpRecvBuffer(int tcpRecvBuffer) {
212 tcpRecvBuffer_ = tcpRecvBuffer;
213}
214
215void TNonblockingServerSocket::_setup_sockopts() {

Callers

nothing calls this directly

Calls 2

THRIFT_STATClass · 0.70
perrorMethod · 0.45

Tested by

no test coverage detected