Initial corking and copy strategy, large and small sends

This commit is contained in:
Alex Hultman
2018-06-25 00:14:22 +02:00
parent ccff240619
commit f206a0c931
2 changed files with 34 additions and 24 deletions
+5 -6
View File
@@ -1,15 +1,14 @@
#include <string>
#include "uWS.h"
std::string buffer;
#include "uWS.h"
//#define USE_SSL
int main() {
buffer = "HTTP/1.1 200 OK\r\nContent-Length: 52428800\r\n\r\n";
buffer.resize(52428800 + buffer.length());
buffer = "Hello world!";
//buffer.resize(512);
//uWS::init();
//uWS::Loop loop();
@@ -25,7 +24,7 @@ int main() {
app.onGet("/", [](auto *s, auto *req, auto *args) {
s->/*writeStatus("200 OK")->*/write([](int offset) {
s->writeStatus("200 OK")->write([](int offset) {
return std::string_view(buffer.data() + offset, buffer.length() - offset);
}, buffer.length());