Browse Source

fixed WebThreeStubServer constructor

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
874abf6e0b
  1. 2
      alethzero/MainWin.cpp
  2. 9
      eth/main.cpp
  3. 4
      libweb3jsonrpc/WebThreeStubServer.cpp
  4. 2
      libweb3jsonrpc/WebThreeStubServer.h
  5. 7
      neth/main.cpp
  6. 4
      test/jsonrpc.cpp
  7. 2
      third/MainWin.cpp

2
alethzero/MainWin.cpp

@ -149,7 +149,7 @@ Main::Main(QWidget *parent) :
m_webThree.reset(new WebThreeDirect(string("AlethZero/v") + dev::Version + "/" DEV_QUOTED(ETH_BUILD_TYPE) "/" DEV_QUOTED(ETH_BUILD_PLATFORM), getDataDir() + "/AlethZero", false, {"eth", "shh"}));
m_server = unique_ptr<WebThreeStubServer>(new WebThreeStubServer(&m_qwebConnector, *web3(), keysAsVector(m_myKeys)));
m_server = unique_ptr<WebThreeStubServer>(new WebThreeStubServer(m_qwebConnector, *web3(), keysAsVector(m_myKeys)));
m_server->setIdentities(keysAsVector(owned()));
m_server->StartListening();

9
eth/main.cpp

@ -336,10 +336,12 @@ int main(int argc, char** argv)
web3.connect(remoteHost, remotePort);
#if ETH_JSONRPC
auto_ptr<WebThreeStubServer> jsonrpcServer;
unique_ptr<WebThreeStubServer> jsonrpcServer;
unique_ptr<jsonrpc::AbstractServerConnector> jsonrpcConnector;
if (jsonrpc > -1)
{
jsonrpcServer = auto_ptr<WebThreeStubServer>(new WebThreeStubServer(new jsonrpc::CorsHttpServer(jsonrpc), web3, {us}));
jsonrpcConnector = unique_ptr<jsonrpc::AbstractServerConnector>(new jsonrpc::CorsHttpServer(jsonrpc));
jsonrpcServer = unique_ptr<WebThreeStubServer>(new WebThreeStubServer(*jsonrpcConnector.get(), web3, {us}));
jsonrpcServer->setIdentities({us});
jsonrpcServer->StartListening();
}
@ -427,7 +429,8 @@ int main(int argc, char** argv)
{
if (jsonrpc < 0)
jsonrpc = 8080;
jsonrpcServer = auto_ptr<WebThreeStubServer>(new WebThreeStubServer(new jsonrpc::CorsHttpServer(jsonrpc), web3, {us}));
jsonrpcConnector = unique_ptr<jsonrpc::AbstractServerConnector>(new jsonrpc::CorsHttpServer(jsonrpc));
jsonrpcServer = auto_ptr<WebThreeStubServer>(new WebThreeStubServer(*jsonrpcConnector.get(), web3, {us}));
jsonrpcServer->setIdentities({us});
jsonrpcServer->StartListening();
}

4
libweb3jsonrpc/WebThreeStubServer.cpp

@ -216,8 +216,8 @@ static Json::Value toJson(h256 const& _h, shh::Envelope const& _e, shh::Message
}
WebThreeStubServer::WebThreeStubServer(jsonrpc::AbstractServerConnector* _conn, WebThreeDirect& _web3, std::vector<dev::KeyPair> const& _accounts):
AbstractWebThreeStubServer(*_conn),
WebThreeStubServer::WebThreeStubServer(jsonrpc::AbstractServerConnector& _conn, WebThreeDirect& _web3, std::vector<dev::KeyPair> const& _accounts):
AbstractWebThreeStubServer(_conn),
m_web3(_web3)
{
setAccounts(_accounts);

2
libweb3jsonrpc/WebThreeStubServer.h

@ -60,7 +60,7 @@ class Interface;
class WebThreeStubServer: public AbstractWebThreeStubServer
{
public:
WebThreeStubServer(jsonrpc::AbstractServerConnector* _conn, dev::WebThreeDirect& _web3, std::vector<dev::KeyPair> const& _accounts);
WebThreeStubServer(jsonrpc::AbstractServerConnector& _conn, dev::WebThreeDirect& _web3, std::vector<dev::KeyPair> const& _accounts);
virtual std::string account();
virtual Json::Value accounts();

7
neth/main.cpp

@ -476,9 +476,11 @@ int main(int argc, char** argv)
#if ETH_JSONRPC
auto_ptr<WebThreeStubServer> jsonrpcServer;
unique_ptr<jsonrpc::AbstractServerConnector> jsonrpcConnector;
if (jsonrpc > -1)
{
jsonrpcServer = auto_ptr<WebThreeStubServer>(new WebThreeStubServer(new jsonrpc::HttpServer(jsonrpc), web3, {us}));
jsonrpcConnector = unique_ptr<jsonrpc::AbstractServerConnector>(new jsonrpc::HttpServer(jsonrpc));
jsonrpcServer = auto_ptr<WebThreeStubServer>(new WebThreeStubServer(*jsonrpcConnector.get(), web3, {us}));
jsonrpcServer->setIdentities({us});
jsonrpcServer->StartListening();
}
@ -552,7 +554,8 @@ int main(int argc, char** argv)
{
if (jsonrpc < 0)
jsonrpc = 8080;
jsonrpcServer = auto_ptr<WebThreeStubServer>(new WebThreeStubServer(new jsonrpc::HttpServer(jsonrpc), web3, {us}));
jsonrpcConnector = unique_ptr<jsonrpc::AbstractServerConnector>(new jsonrpc::HttpServer(jsonrpc));
jsonrpcServer = auto_ptr<WebThreeStubServer>(new WebThreeStubServer(*jsonrpcConnector.get(), web3, {us}));
jsonrpcServer->setIdentities({us});
jsonrpcServer->StartListening();
}

4
test/jsonrpc.cpp

@ -54,6 +54,7 @@ dev::WebThreeDirect web3(name, dbPath, true, s, np);
unique_ptr<WebThreeStubServer> jsonrpcServer;
unique_ptr<WebThreeStubClient> jsonrpcClient;
unique_ptr<jsonrpc::AbstractServerConnector> jsonrpcConnector;
jsonrpc::HttpClient httpClient("http://localhost:8080");
struct JsonrpcFixture {
@ -63,7 +64,8 @@ struct JsonrpcFixture {
web3.setIdealPeerCount(5);
web3.ethereum()->setForceMining(true);
jsonrpcServer = unique_ptr<WebThreeStubServer>(new WebThreeStubServer(new jsonrpc::CorsHttpServer(8080), web3, {}));
jsonrpcConnector = unique_ptr<jsonrpc::AbstractServerConnector>(new jsonrpc::CorsHttpServer(8080));
jsonrpcServer = unique_ptr<WebThreeStubServer>(new WebThreeStubServer(*jsonrpcConnector.get(), web3, {}));
jsonrpcServer->setIdentities({});
jsonrpcServer->StartListening();

2
third/MainWin.cpp

@ -117,7 +117,7 @@ Main::Main(QWidget *parent) :
m_web3.reset(new WebThreeDirect("Third", getDataDir() + "/Third", false, {"eth", "shh"}));
m_web3->connect(Host::pocHost());
m_server = unique_ptr<WebThreeStubServer>(new WebThreeStubServer(&m_qwebConnector, *web3(), keysAsVector(m_myKeys)));
m_server = unique_ptr<WebThreeStubServer>(new WebThreeStubServer(m_qwebConnector, *web3(), keysAsVector(m_myKeys)));
m_server->setIdentities(keysAsVector(owned()));
m_server->StartListening();

Loading…
Cancel
Save