From dd8559628e58b496cde18d0433b694564d4d4c25 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Fri, 18 Jan 2013 02:47:36 -0800 Subject: [PATCH] Pass the correct remote IP address down. --- src/cpp/ripple/WSConnection.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cpp/ripple/WSConnection.h b/src/cpp/ripple/WSConnection.h index 90d43d82eb..0bb51e9756 100644 --- a/src/cpp/ripple/WSConnection.h +++ b/src/cpp/ripple/WSConnection.h @@ -41,6 +41,7 @@ protected: WSServerHandler* mHandler; weak_connection_ptr mConnection; NetworkOPs& mNetwork; + std::string mRemoteIP; boost::asio::deadline_timer mPingTimer; bool mPinged; @@ -53,7 +54,11 @@ public: WSConnection(WSServerHandler* wshpHandler, const connection_ptr& cpConnection) : mHandler(wshpHandler), mConnection(cpConnection), mNetwork(theApp->getOPs()), mPingTimer(theApp->getAuxService()), mPinged(false) - { setPingTimer(); } + { + mRemoteIP = cpConnection->get_socket().lowest_layer().remote_endpoint().address().to_string(); + cLog(lsDEBUG) << "Websocket connection from " << mRemoteIP; + setPingTimer(); + } void preDestroy() { // sever connection @@ -94,7 +99,7 @@ public: int iRole = mHandler->getPublic() ? RPCHandler::GUEST // Don't check on the public interface. - : iAdminGet(jvRequest, "127.0.0.1"); // XXX Fix this to return the remote IP. + : iAdminGet(jvRequest, mRemoteIP); // XXX Fix this to return the remote IP. if (RPCHandler::FORBID == iRole) {