MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / DoUpload

Method DoUpload

src/Networking/FtpResponder.cpp:354–386  ·  view source on GitHub ↗

Write some more upload data

Source from the content-addressed store, hash-verified

352
353// Write some more upload data
354void FtpResponder::DoUpload() noexcept
355{
356 // Write incoming data to the file
357 const uint8_t *_ecv_array buffer;
358 size_t len;
359 if (dataSocket->ReadBuffer(buffer, len))
360 {
361 if (reprap.Debug(Module::Webserver))
362 {
363 GetPlatform().MessageF(UsbMessage, "Writing %u bytes of upload data\n", len);
364 }
365
366 dataSocket->Taken(len);
367 if (!fileBeingUploaded.Write(buffer, len))
368 {
369 uploadError = true;
370 GetPlatform().Message(ErrorMessage, "FTP: could not write upload data\n");
371 CancelUpload();
372
373 responderState = ResponderState::pasvTransferComplete;
374 return;
375 }
376 }
377
378 // Upload has finished if the connection is closed
379 if (!dataSocket->CanRead())
380 {
381 dataSocket = nullptr;
382 responderState = ResponderState::pasvTransferComplete;
383
384 FinishUpload(0, 0, false, 0);
385 }
386}
387
388// Try to read some data from the main FTP port and return true
389// if anything significant could be done

Callers

nothing calls this directly

Calls 7

DebugMethod · 0.80
MessageMethod · 0.80
WriteMethod · 0.60
ReadBufferMethod · 0.45
MessageFMethod · 0.45
TakenMethod · 0.45
CanReadMethod · 0.45

Tested by

no test coverage detected