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
8 years ago
by
Deomid Ryabkov
Committed by
Cesanta Bot
8 years ago
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
Hide 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,
(
sa
->
sa
.
sa_family
==
AF_INET
)
?
sizeof
(
sa
->
sin
)
:
sizeof
(
sa
->
sin6
);
sock_t
sock
=
sl_Socket
(
sa
->
sa
.
sa_family
,
type
,
proto
);
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
);
return
r
;
}
...
...
@@ -10792,7 +10792,7 @@ static void mg_write_to_socket(struct mg_connection *nc) {
if
(
nc
->
flags
&
MG_F_UDP
)
{
n
=
sl_SendTo
(
nc
->
sock
,
io
->
buf
,
io
->
len
,
0
,
&
nc
->
sa
.
sa
,
sizeof
(
nc
->
sa
.
sin
));
sizeof
(
nc
->
sa
.
sin
));
DBG
((
"%p %d %d %d %s:%hu"
,
nc
,
nc
->
sock
,
n
,
errno
,
inet_ntoa
(
nc
->
sa
.
sin
.
sin_addr
),
ntohs
(
nc
->
sa
.
sin
.
sin_port
)));
}
else
{
...
...
@@ -10946,13 +10946,13 @@ time_t mg_mgr_poll(struct mg_mgr *mgr, int timeout_ms) {
double
min_timer
;
struct
mg_connection
*
nc
,
*
tmp
;
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
;
int
num_fds
,
num_ev
,
num_timers
=
0
;
FD_ZERO
(
&
read_set
);
FD_ZERO
(
&
write_set
);
FD_ZERO
(
&
err_set
);
SL_
FD_ZERO
(
&
read_set
);
SL_
FD_ZERO
(
&
write_set
);
SL_
FD_ZERO
(
&
err_set
);
/*
* 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) {
if
(
!
(
nc
->
flags
&
MG_F_WANT_WRITE
)
&&
nc
->
recv_mbuf
.
len
<
nc
->
recv_mbuf_limit
&&
(
!
(
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
(((
nc
->
flags
&
MG_F_CONNECTING
)
&&
!
(
nc
->
flags
&
MG_F_WANT_READ
))
||
(
nc
->
send_mbuf
.
len
>
0
&&
!
(
nc
->
flags
&
MG_F_CONNECTING
)))
{
FD_SET
(
nc
->
sock
,
&
write_set
);
FD_SET
(
nc
->
sock
,
&
err_set
);
SL_
FD_SET
(
nc
->
sock
,
&
write_set
);
SL_
FD_SET
(
nc
->
sock
,
&
err_set
);
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) {
int
fd_flags
=
0
;
if
(
nc
->
sock
!=
INVALID_SOCKET
)
{
if
(
num_ev
>
0
)
{
fd_flags
=
(
FD_ISSET
(
nc
->
sock
,
&
read_set
)
&&
(
!
(
nc
->
flags
&
MG_F_UDP
)
||
nc
->
listener
==
NULL
)
?
_MG_F_FD_CAN_READ
:
0
)
|
(
FD_ISSET
(
nc
->
sock
,
&
write_set
)
?
_MG_F_FD_CAN_WRITE
:
0
)
|
(
FD_ISSET
(
nc
->
sock
,
&
err_set
)
?
_MG_F_FD_ERROR
:
0
);
fd_flags
=
(
SL_FD_ISSET
(
nc
->
sock
,
&
read_set
)
&&
(
!
(
nc
->
flags
&
MG_F_UDP
)
||
nc
->
listener
==
NULL
)
?
_MG_F_FD_CAN_READ
:
0
)
|
(
SL_FD_ISSET
(
nc
->
sock
,
&
write_set
)
?
_MG_F_FD_CAN_WRITE
:
0
)
|
(
SL_FD_ISSET
(
nc
->
sock
,
&
err_set
)
?
_MG_F_FD_ERROR
:
0
);
}
/* SimpleLink does not report UDP sockets as writeable. */
if
(
nc
->
flags
&
MG_F_UDP
&&
nc
->
send_mbuf
.
len
>
0
)
{
...
...
This diff is collapsed.
Click to expand it.
mongoose.h
View file @
7414a4fb
...
...
@@ -732,31 +732,11 @@ int _stat(const char *pathname, struct stat *st);
#define SOCK_STREAM SL_SOCK_STREAM
#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 ntohl sl_Ntohl
#define htons sl_Htons
#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
#define EACCES SL_EACCES
#endif
...
...
This diff is collapsed.
Click to expand it.
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