Commit 8b575a6f authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

sync with trunk


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/jinmei-asio@1209 e5f2f494-b856-4b98-b285-d166d9295462
parent 1af48847
......@@ -157,17 +157,17 @@ Session::recvmsg(ElementPtr& msg, bool nonblock)
if (header_length != length) {
throw SessionError("Received non-empty body where only a header expected");
}
char *buffer = new char[length];
ret = read(sock, buffer, length);
if (ret != length)
std::vector<char> buffer(length);
ret = read(sock, &buffer[0], length);
if (ret != length) {
throw SessionError("Short read");
}
std::string wire = std::string(buffer, length);
delete [] buffer;
std::string wire = std::string(&buffer[0], length);
std::stringstream wire_stream;
wire_stream <<wire;
wire_stream << wire;
msg = Element::fromWire(wire_stream, length);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment