Skip to content

Commit d928be1

Browse files
authored
Merge pull request #671 from evoskuil/master
Use base16 stream for text block serialization.
2 parents 9eeabc9 + 229b24a commit d928be1

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

src/protocols/protocol_native.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ bool protocol_native::handle_get_block(const code& ec, interface::block,
224224
case data:
225225
{
226226
data_chunk out(size);
227-
stream::flip::fast sink{ out };
228-
flip::bytes::fast writer{ sink };
227+
stream::out::fast sink{ out };
228+
write::bytes::fast writer{ sink };
229229
if (!query.get_wire_block(writer, link, witness))
230230
{
231231
send_internal_server_error(database::error::integrity);
@@ -237,17 +237,16 @@ bool protocol_native::handle_get_block(const code& ec, interface::block,
237237
}
238238
case text:
239239
{
240-
data_chunk out(size);
241-
stream::flip::fast sink{ out };
242-
flip::bytes::fast writer{ sink };
240+
std::string out(two * size, '\0');
241+
stream::out::fast sink{ out };
242+
write::base16::fast writer{ sink };
243243
if (!query.get_wire_block(writer, link, witness))
244244
{
245245
send_internal_server_error(database::error::integrity);
246246
return true;
247247
}
248248

249-
// block conversion because there's no hex_flipper.
250-
send_text(encode_base16(out));
249+
send_text(std::move(out));
251250
return true;
252251
}
253252
case json:

0 commit comments

Comments
 (0)