Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

rpc: Use UnixSocketServer from libjson-rpc-cpp #4688

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ find_package(Snappy CONFIG REQUIRED)
hunter_add_package(cryptopp)
find_package(cryptopp CONFIG REQUIRED)

include(ProjectJsonRpcCpp)
hunter_add_package(libjson-rpc-cpp)
find_package(libjson-rpc-cpp CONFIG REQUIRED)

include(ProjectSecp256k1)
include(ProjectLibFF)

Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ defaults:
save-deps-cache: &save-deps-cache
cache-save:
name: "Save dependencies cache"
key: &deps-cache-key deps-2-{{arch}}-{{checksum "compiler.version"}}-{{checksum "cmake/ProjectJsonRpcCpp.cmake"}}
key: &deps-cache-key deps-2-{{arch}}-{{checksum "compiler.version"}}-{{checksum "cmake/LibFF.cmake"}}
paths:
- build/deps

Expand Down
16 changes: 15 additions & 1 deletion cmake/Hunter/config.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
# cryptopp has very bad CMakeLists.txt config.
# We have to enforce "cross compiling mode" there by setting CMAKE_SYSTEM_VERSION=NO
# to any "false" value.
hunter_config(cryptopp VERSION ${HUNTER_cryptopp_VERSION} CMAKE_ARGS CMAKE_SYSTEM_VERSION=NO)
hunter_config(cryptopp VERSION ${HUNTER_cryptopp_VERSION} CMAKE_ARGS CMAKE_SYSTEM_VERSION=NO)

hunter_config(
libjson-rpc-cpp
VERSION ${HUNTER_libjson-rpc-cpp_VERSION}
CMAKE_ARGS
UNIX_DOMAIN_SOCKET_SERVER=YES
UNIX_DOMAIN_SOCKET_CLIENT=NO
FILE_DESCRIPTOR_SERVER=NO
FILE_DESCRIPTOR_CLIENT=NO
TCP_SOCKET_SERVER=NO
TCP_SOCKET_CLIENT=NO
HTTP_SERVER=NO
HTTP_CLIENT=NO
)
84 changes: 0 additions & 84 deletions cmake/ProjectJsonRpcCpp.cmake

This file was deleted.

9 changes: 8 additions & 1 deletion eth/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1152,9 +1152,16 @@ int main(int argc, char** argv)
new rpc::Debug(*web3.ethereum()),
testEth
));
auto ipcConnector = new IpcServer("geth");

fs::path ipcPath = getIpcPath();
if (ipcPath.empty())
ipcPath = getDataDir();
ipcPath /= "geth.ipc";

auto ipcConnector = new IpcServer(ipcPath.string());
jsonrpcIpcServer->addConnector(ipcConnector);
ipcConnector->StartListening();
cnote << "IPC path: " << ipcPath;


if (jsonAdmin.empty())
Expand Down
2 changes: 1 addition & 1 deletion libweb3jsonrpc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jsonrpcstub_create(web3jsonrpc test.json
TestClient ${CMAKE_CURRENT_BINARY_DIR} TestClient
)

target_link_libraries(web3jsonrpc ethashseal webthree JsonRpcCpp::Server)
target_link_libraries(web3jsonrpc ethashseal webthree libjson-rpc-cpp::server)
14 changes: 6 additions & 8 deletions libweb3jsonrpc/IpcServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,19 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file IpcServer.h
* @authors:
* Arkadiy Paronyan <arkadiy@ethdev.com>
* @date 2015
*/
#pragma once

#include "UnixSocketServer.h"
#if _WIN32
#include "WinPipeServer.h"
#else
#include <jsonrpccpp/server/connectors/unixdomainsocketserver.h>
#endif

namespace dev
{
#if defined(_WIN32)
using IpcServer = WindowsPipeServer;
using IpcServer = WindowsPipeServer;
#else
using IpcServer = UnixDomainSocketServer;
using IpcServer = jsonrpc::UnixDomainSocketServer;
#endif
} // namespace dev