updated picoTCP to 1.4.0, lowered build optimization levels to -O2, improved selftest
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*********************************************************************
|
||||
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
|
||||
See LICENSE and COPYING for usage.
|
||||
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
|
||||
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
|
||||
|
||||
.
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
#include <pico_tftp.h>
|
||||
#include <pico_strings.h>
|
||||
|
||||
#ifdef DEBUG_TFTP
|
||||
#define tftp_dbg dbg
|
||||
#else
|
||||
#define tftp_dbg(...) do {} while(0)
|
||||
#endif
|
||||
|
||||
/* a zero value means adaptative timeout! (2, 4, 8) */
|
||||
#define PICO_TFTP_TIMEOUT 2000U
|
||||
|
||||
@@ -291,6 +297,7 @@ static inline int do_callback(struct pico_tftp_session *session, uint16_t err, u
|
||||
}
|
||||
|
||||
static void timer_callback(pico_time now, void *arg);
|
||||
static void tftp_finish(struct pico_tftp_session *session);
|
||||
|
||||
static void tftp_schedule_timeout(struct pico_tftp_session *session, pico_time interval)
|
||||
{
|
||||
@@ -299,10 +306,20 @@ static void tftp_schedule_timeout(struct pico_tftp_session *session, pico_time i
|
||||
if (session->active_timers) {
|
||||
if (session->bigger_wallclock > new_timeout) {
|
||||
session->timer = pico_timer_add(interval + 1, timer_callback, session);
|
||||
if (!session->timer) {
|
||||
tftp_dbg("TFTP: Failed to start callback timer, deleting session\n");
|
||||
tftp_finish(session);
|
||||
return;
|
||||
}
|
||||
session->active_timers++;
|
||||
}
|
||||
} else {
|
||||
session->timer = pico_timer_add(interval + 1, timer_callback, session);
|
||||
if (!session->timer) {
|
||||
tftp_dbg("TFTP: Failed to start callback timer, deleting session\n");
|
||||
tftp_finish(session);
|
||||
return;
|
||||
}
|
||||
session->active_timers++;
|
||||
session->bigger_wallclock = new_timeout;
|
||||
}
|
||||
@@ -389,7 +406,9 @@ static void tftp_send_oack(struct pico_tftp_session *session)
|
||||
size_t options_size;
|
||||
size_t options_pos = sizeof(struct pico_tftp_hdr);
|
||||
uint8_t *buf;
|
||||
char str_options[MAX_OPTIONS_SIZE] = { 0 };
|
||||
char str_options[MAX_OPTIONS_SIZE] = {
|
||||
0
|
||||
};
|
||||
|
||||
options_size = prepare_options_string(session, str_options, session->file_size);
|
||||
|
||||
@@ -419,7 +438,9 @@ static void tftp_send_req(struct pico_tftp_session *session, union pico_address
|
||||
size_t options_size;
|
||||
size_t options_pos;
|
||||
uint8_t *buf;
|
||||
char str_options[MAX_OPTIONS_SIZE] = { 0 };
|
||||
char str_options[MAX_OPTIONS_SIZE] = {
|
||||
0
|
||||
};
|
||||
|
||||
if (!filename) {
|
||||
return;
|
||||
@@ -1263,6 +1284,7 @@ int32_t pico_tftp_get(struct pico_tftp_session *session, uint8_t *data, int32_t
|
||||
pico_err = PICO_ERR_EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
synchro = *(int*)session->argument;
|
||||
*(int*)session->argument = 0;
|
||||
if ((session->state != TFTP_STATE_RX) && (session->state != TFTP_STATE_READ_REQUESTED))
|
||||
@@ -1287,6 +1309,7 @@ int32_t pico_tftp_put(struct pico_tftp_session *session, uint8_t *data, int32_t
|
||||
pico_err = PICO_ERR_EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
synchro = *(int*)session->argument;
|
||||
*(int*)session->argument = 0;
|
||||
if (synchro < 0)
|
||||
|
||||
Reference in New Issue
Block a user