Selaa lähdekoodia

ensure write buffer size is enough

ithewei 3 vuotta sitten
vanhempi
commit
a88bb2ec16
1 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 4 0
      http/client/AsyncHttpClient.cpp

+ 4 - 0
http/client/AsyncHttpClient.cpp

@@ -159,6 +159,10 @@ int AsyncHttpClient::sendRequest(const SocketChannelPtr& channel) {
     char* data = NULL;
     size_t len = 0;
     while (ctx->parser->GetSendData(&data, &len)) {
+        // NOTE: ensure write buffer size is enough
+        if (len > (1 << 22) /* 4M */) {
+            channel->setMaxWriteBufsize(len);
+        }
         channel->write(data, len);
     }
     channel->startRead();