Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: oldheating gps motorhome heating
Diff: udp/tftp.c
- Revision:
- 93:580fc113d9e9
- Parent:
- 83:08c983006a6e
- Child:
- 114:13fc2c25d105
--- a/udp/tftp.c Thu Nov 29 16:52:10 2018 +0000
+++ b/udp/tftp.c Sun Dec 02 18:40:35 2018 +0000
@@ -15,11 +15,11 @@
#include "dns.h"
#include "mac.h"
#include "tftp.h"
-#include "clock.h"
+#include "mstimer.h"
bool TftpTrace = false;
-#define WRITE_TIMEOUT_SECS 5
+#define WRITE_TIMEOUT_MS 5000
#define TFTP_RRQ 1
#define TFTP_WRQ 2
@@ -295,13 +295,12 @@
*pSize = size;
return ActionMakeFromDestAndTrace(dest, TftpTrace && NetTraceStack);
}
-int elapsed = 0;
+static uint32_t writeStartMs = 0;
void TftpMain()
{
if (TftpWriteStatus == TFTP_WRITE_STATUS_IN_PROGRESS)
{
- if (ClockTicked) elapsed++;
- if (elapsed > WRITE_TIMEOUT_SECS)
+ if (MsTimerHasElapsed(writeStartMs, WRITE_TIMEOUT_MS))
{
TftpWriteStatus = TFTP_WRITE_STATUS_NONE;
LogTime("TFTP - write operation timed out so reset\r\n");
@@ -309,6 +308,6 @@
}
else
{
- elapsed = 0;
+ writeStartMs = MsTimerCount;
}
}
\ No newline at end of file