mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
esp32: ROMFS use checksum as mtime so ETAG caching works
This commit is contained in:
parent
89212d6668
commit
36e04f33f5
4 changed files with 9 additions and 5 deletions
|
@ -653,13 +653,13 @@ esp32_lws_fops_open(const struct lws_plat_file_ops *fops, const char *filename,
|
|||
{
|
||||
struct esp32_file *f = malloc(sizeof(*f));
|
||||
lws_fop_fd_t fop_fd;
|
||||
size_t len;
|
||||
size_t len, csum;
|
||||
|
||||
lwsl_notice("%s: %s\n", __func__, filename);
|
||||
|
||||
if (!f)
|
||||
return NULL;
|
||||
f->i = romfs_get_info(lws_esp32_romfs, filename, &len);
|
||||
f->i = romfs_get_info(lws_esp32_romfs, filename, &len, &csum);
|
||||
if (!f->i)
|
||||
goto bail;
|
||||
|
||||
|
@ -669,6 +669,8 @@ esp32_lws_fops_open(const struct lws_plat_file_ops *fops, const char *filename,
|
|||
|
||||
fop_fd->fops = fops;
|
||||
fop_fd->filesystem_priv = f;
|
||||
fop_fd->mod_time = csum;
|
||||
*flags |= LWS_FOP_FLAG_MOD_TIME_VALID;
|
||||
fop_fd->flags = *flags;
|
||||
|
||||
fop_fd->len = len;
|
||||
|
|
|
@ -203,7 +203,7 @@ romfs_lookup(romfs_t romfs, romfs_inode_t start, const char *path)
|
|||
}
|
||||
|
||||
const void *
|
||||
romfs_get_info(romfs_t romfs, const char *path, size_t *len)
|
||||
romfs_get_info(romfs_t romfs, const char *path, size_t *len, size_t *csum)
|
||||
{
|
||||
romfs_inode_t i;
|
||||
|
||||
|
@ -217,6 +217,8 @@ romfs_get_info(romfs_t romfs, const char *path, size_t *len)
|
|||
|
||||
set_cache(i, sizeof(*i));
|
||||
*len = ntohl(ci->size);
|
||||
if (csum)
|
||||
*csum = ntohl(ci->checksum);
|
||||
|
||||
return (void *)skip_and_pad(i);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ typedef const struct romfs_i *romfs_inode_t;
|
|||
typedef const struct romfs_superblock *romfs_t;
|
||||
|
||||
const void *
|
||||
romfs_get_info(romfs_t romfs, const char *path, size_t *len);
|
||||
romfs_get_info(romfs_t romfs, const char *path, size_t *len, size_t *csum);
|
||||
size_t
|
||||
romfs_mount_check(romfs_t romfs);
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ static void reboot_timer_cb(TimerHandle_t t)
|
|||
static int
|
||||
client_connection(struct per_vhost_data__esplws_scan *vhd, const char *file)
|
||||
{
|
||||
#if CONFIG_LWS_IS_FACTORY_APPLICATION == 'y' && defined(CONFIG_LWS_OTA_SERVER_BASE_URL) &&
|
||||
#if CONFIG_LWS_IS_FACTORY_APPLICATION == 'y' && defined(CONFIG_LWS_OTA_SERVER_BASE_URL) && \
|
||||
defined(CONFIG_LWS_OTA_SERVER_FQDN)
|
||||
static struct lws_client_connect_info i;
|
||||
char path[256];
|
||||
|
|
Loading…
Add table
Reference in a new issue