Skip to content

Commit b20fa1e

Browse files
committed
send a test message
Signed-off-by: faradaym <[email protected]>
1 parent 80bfcab commit b20fa1e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/DuckNet.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,11 @@ int DuckNet::setupWebServer(bool createCaptivePortal, std::string html) {
188188

189189
webServer.on("/atakHistory", HTTP_GET, [&](AsyncWebServerRequest* request){
190190
const uint8_t* atakBytes = DuckNet::serializeAtakHistoryToBytes(&atakBuffer);
191-
size_t atakSize = 229 * CDPCFG_CDP_CHATBUF_SIZE;
191+
size_t atakSize = 229 * CDPCFG_CDP_CHATBUF_SIZE + 4;
192192
const char* atakType = "application/octet-stream";
193193
AsyncWebServerResponse *response = request->beginResponse_P(200, atakType, atakBytes, atakSize);
194-
delete[] atakBytes;
194+
request->send(response);
195+
delete[] atakBytes; //this needs to be fixed bc async
195196

196197
});
197198
webServer.on("/atakChatHistory", HTTP_GET, [&](AsyncWebServerRequest* request){
@@ -387,7 +388,7 @@ std::string DuckNet::serializeAtakHistoryToJSON(CircularBuffer* buffer) {
387388
}
388389
uint8_t* DuckNet::serializeAtakHistoryToBytes(CircularBuffer* buffer){
389390
int tail = buffer->getTail();
390-
uint8_t* atakBytes = new uint8_t[229 * CDPCFG_CDP_CHATBUF_SIZE];
391+
uint8_t* atakBytes = new uint8_t[229 * CDPCFG_CDP_CHATBUF_SIZE + 4];
391392
int offset = 0;
392393
while(tail != buffer->getHead()){
393394
CdpPacket packet = buffer->getMessage(tail);
@@ -397,6 +398,7 @@ uint8_t* DuckNet::serializeAtakHistoryToBytes(CircularBuffer* buffer){
397398
if(tail == buffer->getBufferEnd()){
398399
tail = 0;
399400
}
401+
atakBytes[offset++] = 'duck';
400402
}
401403
return atakBytes;
402404
}

0 commit comments

Comments
 (0)