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
7414a4fb
Commit
7414a4fb
authored
Sep 22, 2016
by
Deomid Ryabkov
Committed by
Cesanta Bot
Sep 22, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop pretending that sl_* API is BSD-compatible
PUBLISHED_FROM=355fea9a5a75ac926d4c64d41828ebcd96c04080
parent
abbd44e2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
35 deletions
+16
-35
mongoose.c
mongoose.c
+16
-15
mongoose.h
mongoose.h
+0
-20
No files found.
mongoose.c
View file @
7414a4fb
...
@@ -10774,7 +10774,7 @@ static sock_t mg_open_listening_socket(union socket_address *sa, int type,
...
@@ -10774,7 +10774,7 @@ static sock_t mg_open_listening_socket(union socket_address *sa, int type,
(
sa
->
sa
.
sa_family
==
AF_INET
)
?
sizeof
(
sa
->
sin
)
:
sizeof
(
sa
->
sin6
);
(
sa
->
sa
.
sa_family
==
AF_INET
)
?
sizeof
(
sa
->
sin
)
:
sizeof
(
sa
->
sin6
);
sock_t
sock
=
sl_Socket
(
sa
->
sa
.
sa_family
,
type
,
proto
);
sock_t
sock
=
sl_Socket
(
sa
->
sa
.
sa_family
,
type
,
proto
);
if
(
sock
<
0
)
return
sock
;
if
(
sock
<
0
)
return
sock
;
if
((
r
=
b
ind
(
sock
,
&
sa
->
sa
,
sa_len
))
<
0
)
{
if
((
r
=
sl_B
ind
(
sock
,
&
sa
->
sa
,
sa_len
))
<
0
)
{
sl_Close
(
sock
);
sl_Close
(
sock
);
return
r
;
return
r
;
}
}
...
@@ -10946,13 +10946,13 @@ time_t mg_mgr_poll(struct mg_mgr *mgr, int timeout_ms) {
...
@@ -10946,13 +10946,13 @@ time_t mg_mgr_poll(struct mg_mgr *mgr, int timeout_ms) {
double
min_timer
;
double
min_timer
;
struct
mg_connection
*
nc
,
*
tmp
;
struct
mg_connection
*
nc
,
*
tmp
;
struct
SlTimeval_t
tv
;
struct
SlTimeval_t
tv
;
fd_se
t
read_set
,
write_set
,
err_set
;
SlFdSet_
t
read_set
,
write_set
,
err_set
;
sock_t
max_fd
=
INVALID_SOCKET
;
sock_t
max_fd
=
INVALID_SOCKET
;
int
num_fds
,
num_ev
,
num_timers
=
0
;
int
num_fds
,
num_ev
,
num_timers
=
0
;
FD_ZERO
(
&
read_set
);
SL_
FD_ZERO
(
&
read_set
);
FD_ZERO
(
&
write_set
);
SL_
FD_ZERO
(
&
write_set
);
FD_ZERO
(
&
err_set
);
SL_
FD_ZERO
(
&
err_set
);
/*
/*
* Note: it is ok to have connections with sock == INVALID_SOCKET in the list,
* Note: it is ok to have connections with sock == INVALID_SOCKET in the list,
...
@@ -10968,14 +10968,14 @@ time_t mg_mgr_poll(struct mg_mgr *mgr, int timeout_ms) {
...
@@ -10968,14 +10968,14 @@ time_t mg_mgr_poll(struct mg_mgr *mgr, int timeout_ms) {
if
(
!
(
nc
->
flags
&
MG_F_WANT_WRITE
)
&&
if
(
!
(
nc
->
flags
&
MG_F_WANT_WRITE
)
&&
nc
->
recv_mbuf
.
len
<
nc
->
recv_mbuf_limit
&&
nc
->
recv_mbuf
.
len
<
nc
->
recv_mbuf_limit
&&
(
!
(
nc
->
flags
&
MG_F_UDP
)
||
nc
->
listener
==
NULL
))
{
(
!
(
nc
->
flags
&
MG_F_UDP
)
||
nc
->
listener
==
NULL
))
{
FD_SET
(
nc
->
sock
,
&
read_set
);
SL_
FD_SET
(
nc
->
sock
,
&
read_set
);
if
(
max_fd
==
INVALID_SOCKET
||
nc
->
sock
>
max_fd
)
max_fd
=
nc
->
sock
;
if
(
max_fd
==
INVALID_SOCKET
||
nc
->
sock
>
max_fd
)
max_fd
=
nc
->
sock
;
}
}
if
(((
nc
->
flags
&
MG_F_CONNECTING
)
&&
!
(
nc
->
flags
&
MG_F_WANT_READ
))
||
if
(((
nc
->
flags
&
MG_F_CONNECTING
)
&&
!
(
nc
->
flags
&
MG_F_WANT_READ
))
||
(
nc
->
send_mbuf
.
len
>
0
&&
!
(
nc
->
flags
&
MG_F_CONNECTING
)))
{
(
nc
->
send_mbuf
.
len
>
0
&&
!
(
nc
->
flags
&
MG_F_CONNECTING
)))
{
FD_SET
(
nc
->
sock
,
&
write_set
);
SL_
FD_SET
(
nc
->
sock
,
&
write_set
);
FD_SET
(
nc
->
sock
,
&
err_set
);
SL_
FD_SET
(
nc
->
sock
,
&
err_set
);
if
(
max_fd
==
INVALID_SOCKET
||
nc
->
sock
>
max_fd
)
max_fd
=
nc
->
sock
;
if
(
max_fd
==
INVALID_SOCKET
||
nc
->
sock
>
max_fd
)
max_fd
=
nc
->
sock
;
}
}
}
}
...
@@ -11012,12 +11012,13 @@ time_t mg_mgr_poll(struct mg_mgr *mgr, int timeout_ms) {
...
@@ -11012,12 +11012,13 @@ time_t mg_mgr_poll(struct mg_mgr *mgr, int timeout_ms) {
int
fd_flags
=
0
;
int
fd_flags
=
0
;
if
(
nc
->
sock
!=
INVALID_SOCKET
)
{
if
(
nc
->
sock
!=
INVALID_SOCKET
)
{
if
(
num_ev
>
0
)
{
if
(
num_ev
>
0
)
{
fd_flags
=
(
FD_ISSET
(
nc
->
sock
,
&
read_set
)
&&
fd_flags
=
(
SL_FD_ISSET
(
nc
->
sock
,
&
read_set
)
&&
(
!
(
nc
->
flags
&
MG_F_UDP
)
||
nc
->
listener
==
NULL
)
(
!
(
nc
->
flags
&
MG_F_UDP
)
||
nc
->
listener
==
NULL
)
?
_MG_F_FD_CAN_READ
?
_MG_F_FD_CAN_READ
:
0
)
|
:
0
)
|
(
FD_ISSET
(
nc
->
sock
,
&
write_set
)
?
_MG_F_FD_CAN_WRITE
:
0
)
|
(
SL_
FD_ISSET
(
nc
->
sock
,
&
write_set
)
?
_MG_F_FD_CAN_WRITE
:
0
)
|
(
FD_ISSET
(
nc
->
sock
,
&
err_set
)
?
_MG_F_FD_ERROR
:
0
);
(
SL_
FD_ISSET
(
nc
->
sock
,
&
err_set
)
?
_MG_F_FD_ERROR
:
0
);
}
}
/* SimpleLink does not report UDP sockets as writeable. */
/* SimpleLink does not report UDP sockets as writeable. */
if
(
nc
->
flags
&
MG_F_UDP
&&
nc
->
send_mbuf
.
len
>
0
)
{
if
(
nc
->
flags
&
MG_F_UDP
&&
nc
->
send_mbuf
.
len
>
0
)
{
...
...
mongoose.h
View file @
7414a4fb
...
@@ -732,31 +732,11 @@ int _stat(const char *pathname, struct stat *st);
...
@@ -732,31 +732,11 @@ int _stat(const char *pathname, struct stat *st);
#define SOCK_STREAM SL_SOCK_STREAM
#define SOCK_STREAM SL_SOCK_STREAM
#define SOCK_DGRAM SL_SOCK_DGRAM
#define SOCK_DGRAM SL_SOCK_DGRAM
#define FD_SET SL_FD_SET
#define FD_CLR SL_FD_CLR
#define FD_ISSET SL_FD_ISSET
#define FD_ZERO SL_FD_ZERO
#define fd_set SlFdSet_t
#define htonl sl_Htonl
#define htonl sl_Htonl
#define ntohl sl_Ntohl
#define ntohl sl_Ntohl
#define htons sl_Htons
#define htons sl_Htons
#define ntohs sl_Ntohs
#define ntohs sl_Ntohs
#define accept sl_Accept
#define closesocket sl_Close
#define bind sl_Bind
#define connect sl_Connect
#define listen sl_Listen
#define recv sl_Recv
#define recvfrom sl_RecvFrom
#define send sl_Send
#define sendto sl_SendTo
#define socket sl_Socket
#define select(nfds, rfds, wfds, efds, tout) \
sl_Select((nfds), (rfds), (wfds), (efds), (struct SlTimeval_t *)(tout))
#ifndef EACCES
#ifndef EACCES
#define EACCES SL_EACCES
#define EACCES SL_EACCES
#endif
#endif
...
...
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