Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
5bd3df7a
Commit
5bd3df7a
authored
Oct 20, 2016
by
Marko Mikulicic
Committed by
Cesanta Bot
Oct 20, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix mg_time on mbed and make DNS work around epoch
PUBLISHED_FROM=c1aeef9dc25baba794b3269b44441c5bafbca5a8
parent
5bbf24bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
3 deletions
+56
-3
mongoose.c
mongoose.c
+11
-3
mongoose.h
mongoose.h
+45
-0
No files found.
mongoose.c
View file @
5bd3df7a
...
...
@@ -718,8 +718,12 @@ typedef int cs_dirent_dummy;
#ifndef _WIN32
#include <stddef.h>
#if !defined(CS_PLATFORM) || \
(CS_PLATFORM != CS_P_CC3200 && CS_PLATFORM != CS_P_MSP432)
/*
* There is no sys/time.h on ARMCC.
*/
#if !(defined(__ARMCC_VERSION) || defined(__ICCARM__)) && \
(!defined(CS_PLATFORM) || \
(CS_PLATFORM != CS_P_CC3200 && CS_PLATFORM != CS_P_MSP432))
#include <sys/time.h>
#endif
#else
...
...
@@ -9142,6 +9146,7 @@ static void mg_resolve_async_eh(struct mg_connection *nc, int ev, void *data) {
time_t
now
=
(
time_t
)
mg_time
();
struct
mg_resolve_async_request
*
req
;
struct
mg_dns_message
*
msg
;
int
first
=
0
;
DBG
((
"ev=%d user_data=%p"
,
ev
,
nc
->
user_data
));
...
...
@@ -9153,13 +9158,16 @@ static void mg_resolve_async_eh(struct mg_connection *nc, int ev, void *data) {
switch
(
ev
)
{
case
MG_EV_CONNECT
:
/* don't depend on timer not being at epoch for sending out first req */
first
=
1
;
/* fallthrough */
case
MG_EV_POLL
:
if
(
req
->
retries
>
req
->
max_retries
)
{
req
->
err
=
MG_RESOLVE_EXCEEDED_RETRY_COUNT
;
nc
->
flags
|=
MG_F_CLOSE_IMMEDIATELY
;
break
;
}
if
(
now
-
req
->
last_time
>=
req
->
timeout
)
{
if
(
first
||
now
-
req
->
last_time
>=
req
->
timeout
)
{
mg_send_dns_query
(
nc
,
req
->
name
,
req
->
query
);
req
->
last_time
=
now
;
req
->
retries
++
;
...
...
mongoose.h
View file @
5bd3df7a
...
...
@@ -761,10 +761,55 @@ int _stat(const char *pathname, struct stat *st);
/* Amalgamated: #include "mbed.h" */
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#ifndef CS_ENABLE_STDIO
#define CS_ENABLE_STDIO 1
#endif
/*
* mbed can be compiled with the ARM compiler which
* just doesn't come with a gettimeofday shim
* because it's a BSD API and ARM targets embedded
* non-unix platforms.
*/
#if defined(__ARMCC_VERSION) || defined(__ICCARM__)
#define _TIMEVAL_DEFINED
#define gettimeofday _gettimeofday
/* copied from GCC on ARM; for some reason useconds are signed */
typedef
long
suseconds_t
;
/* microseconds (signed) */
struct
timeval
{
time_t
tv_sec
;
/* seconds */
suseconds_t
tv_usec
;
/* and microseconds */
};
#endif
#if MG_NET_IF == MG_NET_IF_SIMPLELINK
typedef
int
sock_t
;
#define INVALID_SOCKET (-1)
#define to64(x) strtoll(x, NULL, 10)
#define INT64_FMT PRId64
#define INT64_X_FMT PRIx64
#define SIZE_T_FMT "u"
#define SOMAXCONN 8
const
char
*
inet_ntop
(
int
af
,
const
void
*
src
,
char
*
dst
,
socklen_t
size
);
char
*
inet_ntoa
(
struct
in_addr
in
);
int
inet_pton
(
int
af
,
const
char
*
src
,
void
*
dst
);
#endif
/* MG_NET_IF == MG_NET_IF_SIMPLELINK */
#endif
/* CS_PLATFORM == CS_P_MBED */
#endif
/* CS_COMMON_PLATFORMS_PLATFORM_MBED_H_ */
#ifdef MG_MODULE_LINES
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment