Skip to content

Commit

Permalink
zephyr: able to build and run stock TSocketServer
Browse files Browse the repository at this point in the history
TSocketServer, the default TCP/IP Thrift server implementation,
is now able to build and run.

Some additional testing is required - macOS / Qemu user networking
is fairly limited and routing is not behaving well.

Signed-off-by: Christopher Friedt <[email protected]>
  • Loading branch information
cfriedt committed Oct 27, 2022
1 parent e490dea commit e47ba68
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 0 additions & 6 deletions lib/cpp/src/thrift/server/TSimpleServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ class TSimpleServer : public TServerFramework {

~TSimpleServer();

virtual void serve() override;
virtual void stop() override;
virtual int64_t getConcurrentClientLimit() const override;
virtual int64_t getConcurrentClientCount() const override;
virtual int64_t getConcurrentClientCountHWM() const override;

protected:
void onClientConnected(const std::shared_ptr<TConnectedClient>& pClient) override /* override */;
void onClientDisconnected(TConnectedClient* pClient) override /* override */;
Expand Down
4 changes: 4 additions & 0 deletions lib/cpp/src/thrift/transport/TServerSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ void TServerSocket::_setup_sockopts() {
}

// Set TCP buffer sizes
#if 0
if (tcpSendBuffer_ > 0) {
if (-1 == setsockopt(serverSocket_,
SOL_SOCKET,
Expand Down Expand Up @@ -303,15 +304,18 @@ void TServerSocket::_setup_sockopts() {
errno_copy);
}
}
#endif

// Turn linger off, don't want to block on calls to close
#if 0
struct linger ling = {0, 0};
if (-1 == setsockopt(serverSocket_, SOL_SOCKET, SO_LINGER, cast_sockopt(&ling), sizeof(ling))) {
int errno_copy = THRIFT_GET_SOCKET_ERROR;
GlobalOutput.perror("TServerSocket::listen() setsockopt() SO_LINGER ", errno_copy);
close();
throw TTransportException(TTransportException::NOT_OPEN, "Could not set SO_LINGER", errno_copy);
}
#endif

#ifdef SO_NOSIGPIPE
if (-1 == setsockopt(serverSocket_, SOL_SOCKET, SO_NOSIGPIPE, &one, sizeof(one))) {
Expand Down
2 changes: 2 additions & 0 deletions lib/cpp/src/thrift/transport/TSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ void TSocket::setLinger(bool on, int linger) {
return;
}

#if 0
#ifndef _WIN32
struct linger l = {(lingerOn_ ? 1 : 0), lingerVal_};
#else
Expand All @@ -734,6 +735,7 @@ void TSocket::setLinger(bool on, int linger) {
= THRIFT_GET_SOCKET_ERROR; // Copy THRIFT_GET_SOCKET_ERROR because we're allocating memory.
GlobalOutput.perror("TSocket::setLinger() setsockopt() " + getSocketInfo(), errno_copy);
}
#endif
}

void TSocket::setNoDelay(bool noDelay) {
Expand Down

0 comments on commit e47ba68

Please sign in to comment.