aboutsummaryrefslogtreecommitdiffstats
path: root/test/RPCSession.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-02-09 21:06:48 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-02-09 23:40:56 +0800
commitf2cafd497459d7ed0ea7f6efdeeb77a51cacecc7 (patch)
tree051d0df5069e5db1d03c4bc0c54f844cb1350d77 /test/RPCSession.cpp
parentf9a818eaf8713f14f80576ea706d484d2bc92c7b (diff)
downloaddexon-solidity-f2cafd497459d7ed0ea7f6efdeeb77a51cacecc7.tar
dexon-solidity-f2cafd497459d7ed0ea7f6efdeeb77a51cacecc7.tar.gz
dexon-solidity-f2cafd497459d7ed0ea7f6efdeeb77a51cacecc7.tar.bz2
dexon-solidity-f2cafd497459d7ed0ea7f6efdeeb77a51cacecc7.tar.lz
dexon-solidity-f2cafd497459d7ed0ea7f6efdeeb77a51cacecc7.tar.xz
dexon-solidity-f2cafd497459d7ed0ea7f6efdeeb77a51cacecc7.tar.zst
dexon-solidity-f2cafd497459d7ed0ea7f6efdeeb77a51cacecc7.zip
Simplify the Windows IPC code
Diffstat (limited to 'test/RPCSession.cpp')
-rw-r--r--test/RPCSession.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/test/RPCSession.cpp b/test/RPCSession.cpp
index 9d046c4f..caaf9a8c 100644
--- a/test/RPCSession.cpp
+++ b/test/RPCSession.cpp
@@ -80,7 +80,7 @@ IPCSocket::IPCSocket(string const& _path): m_path(_path)
string IPCSocket::sendRequest(string const& _req)
{
#if defined(_WIN32)
- string returnStr;
+ // Write to the pipe.
DWORD cbWritten;
BOOL fSuccess = WriteFile(
m_socket, // pipe handle
@@ -92,9 +92,8 @@ string IPCSocket::sendRequest(string const& _req)
if (!fSuccess)
BOOST_FAIL("WriteFile to pipe failed");
- DWORD cbRead;
-
// Read from the pipe.
+ DWORD cbRead;
fSuccess = ReadFile(
m_socket, // pipe handle
m_readBuf, // buffer to receive reply
@@ -102,12 +101,10 @@ string IPCSocket::sendRequest(string const& _req)
&cbRead, // number of bytes read
NULL); // not overlapped
- returnStr += m_readBuf;
-
if (!fSuccess)
BOOST_FAIL("ReadFile from pipe failed");
- return returnStr;
+ return string(m_readBuf, m_readBuf + cbRead);
#else
if (send(m_socket, _req.c_str(), _req.length(), 0) != (ssize_t)_req.length())
BOOST_FAIL("Writing on IPC failed");