Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
mongoose
Commits
734c13cd
Commit
734c13cd
authored
Feb 11, 2020
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Squash win32 warnings
PUBLISHED_FROM=3819e74efb9ac8ff84a68105107afcacaeeab92a
parent
1bf3ad24
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
20 deletions
+18
-20
mongoose.c
mongoose.c
+9
-10
mg_net.c
src/mg_net.c
+1
-1
mg_net_if_socket.c
src/mg_net_if_socket.c
+8
-9
No files found.
mongoose.c
View file @
734c13cd
...
...
@@ -2746,7 +2746,7 @@ struct mg_connection *mg_if_accept_new_conn(struct mg_connection *lc) {
nc
->
iface
=
lc
->
iface
;
if
(
lc
->
flags
&
MG_F_SSL
)
nc
->
flags
|=
MG_F_SSL
;
mg_add_conn
(
nc
->
mgr
,
nc
);
LOG
(
LL_DEBUG
,
(
"%p %p %d %
d"
,
lc
,
nc
,
nc
->
sock
,
(
int
)
nc
->
flags
));
LOG
(
LL_DEBUG
,
(
"%p %p %d %
#x"
,
lc
,
nc
,
(
int
)
nc
->
sock
,
(
int
)
nc
->
flags
));
return
nc
;
}
...
...
@@ -3690,8 +3690,8 @@ void mg_socket_if_connect_tcp(struct mg_connection *nc,
#endif
rc
=
connect
(
nc
->
sock
,
&
sa
->
sa
,
sizeof
(
sa
->
sin
));
nc
->
err
=
rc
<
0
&&
mg_is_error
()
?
mg_get_errno
()
:
0
;
DBG
((
"%p sock %d rc %d errno %d err %d"
,
nc
,
nc
->
sock
,
rc
,
mg_get_errno
()
,
nc
->
err
));
DBG
((
"%p sock %d rc %d errno %d err %d"
,
nc
,
(
int
)
nc
->
sock
,
rc
,
mg_get_errno
(),
nc
->
err
));
}
void
mg_socket_if_connect_udp
(
struct
mg_connection
*
nc
)
{
...
...
@@ -3746,7 +3746,7 @@ static int mg_socket_if_udp_send(struct mg_connection *nc, const void *buf,
static
int
mg_socket_if_tcp_recv
(
struct
mg_connection
*
nc
,
void
*
buf
,
size_t
len
)
{
int
n
=
(
int
)
MG_RECV_FUNC
(
nc
->
sock
,
buf
,
len
,
MSG_DONTWAIT
);
int
n
=
(
int
)
MG_RECV_FUNC
(
nc
->
sock
,
buf
,
len
,
0
);
if
(
n
==
0
)
{
/* Orderly shutdown of the socket, try flushing output. */
nc
->
flags
|=
MG_F_SEND_AND_CLOSE
;
...
...
@@ -3861,8 +3861,8 @@ void mg_mgr_handle_conn(struct mg_connection *nc, int fd_flags, double now) {
int
worth_logging
=
fd_flags
!=
0
||
(
nc
->
flags
&
(
MG_F_WANT_READ
|
MG_F_WANT_WRITE
));
if
(
worth_logging
)
{
DBG
((
"%p fd=%d fd_flags=%d nc_flags=0x%lx rmbl=%d smbl=%d"
,
nc
,
nc
->
sock
,
fd_flags
,
nc
->
flags
,
(
int
)
nc
->
recv_mbuf
.
len
,
DBG
((
"%p fd=%d fd_flags=%d nc_flags=0x%lx rmbl=%d smbl=%d"
,
nc
,
(
int
)
nc
->
sock
,
fd_flags
,
nc
->
flags
,
(
int
)
nc
->
recv_mbuf
.
len
,
(
int
)
nc
->
send_mbuf
.
len
));
}
...
...
@@ -3914,7 +3914,7 @@ void mg_mgr_handle_conn(struct mg_connection *nc, int fd_flags, double now) {
if
(
fd_flags
&
_MG_F_FD_CAN_WRITE
)
mg_if_can_send_cb
(
nc
);
if
(
worth_logging
)
{
DBG
((
"%p after fd=%d nc_flags=0x%lx rmbl=%d smbl=%d"
,
nc
,
nc
->
sock
,
DBG
((
"%p after fd=%d nc_flags=0x%lx rmbl=%d smbl=%d"
,
nc
,
(
int
)
nc
->
sock
,
nc
->
flags
,
(
int
)
nc
->
recv_mbuf
.
len
,
(
int
)
nc
->
send_mbuf
.
len
));
}
}
...
...
@@ -3922,8 +3922,7 @@ void mg_mgr_handle_conn(struct mg_connection *nc, int fd_flags, double now) {
#if MG_ENABLE_BROADCAST
static
void
mg_mgr_handle_ctl_sock
(
struct
mg_mgr
*
mgr
)
{
struct
ctl_msg
ctl_msg
;
int
len
=
(
int
)
MG_RECV_FUNC
(
mgr
->
ctl
[
1
],
(
char
*
)
&
ctl_msg
,
sizeof
(
ctl_msg
),
MSG_DONTWAIT
);
int
len
=
(
int
)
MG_RECV_FUNC
(
mgr
->
ctl
[
1
],
(
char
*
)
&
ctl_msg
,
sizeof
(
ctl_msg
),
0
);
size_t
dummy
=
MG_SEND_FUNC
(
mgr
->
ctl
[
1
],
ctl_msg
.
message
,
1
,
0
);
DBG
((
"read %d from ctl socket"
,
len
));
(
void
)
dummy
;
/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509 */
...
...
@@ -3942,7 +3941,7 @@ void mg_socket_if_sock_set(struct mg_connection *nc, sock_t sock) {
mg_set_non_blocking_mode
(
sock
);
mg_set_close_on_exec
(
sock
);
nc
->
sock
=
sock
;
DBG
((
"%p %d"
,
nc
,
sock
));
DBG
((
"%p %d"
,
nc
,
(
int
)
sock
));
}
void
mg_socket_if_init
(
struct
mg_iface
*
iface
)
{
...
...
src/mg_net.c
View file @
734c13cd
...
...
@@ -540,7 +540,7 @@ struct mg_connection *mg_if_accept_new_conn(struct mg_connection *lc) {
nc
->
iface
=
lc
->
iface
;
if
(
lc
->
flags
&
MG_F_SSL
)
nc
->
flags
|=
MG_F_SSL
;
mg_add_conn
(
nc
->
mgr
,
nc
);
LOG
(
LL_DEBUG
,
(
"%p %p %d %
d"
,
lc
,
nc
,
nc
->
sock
,
(
int
)
nc
->
flags
));
LOG
(
LL_DEBUG
,
(
"%p %p %d %
#x"
,
lc
,
nc
,
(
int
)
nc
->
sock
,
(
int
)
nc
->
flags
));
return
nc
;
}
...
...
src/mg_net_if_socket.c
View file @
734c13cd
...
...
@@ -47,8 +47,8 @@ void mg_socket_if_connect_tcp(struct mg_connection *nc,
#endif
rc
=
connect
(
nc
->
sock
,
&
sa
->
sa
,
sizeof
(
sa
->
sin
));
nc
->
err
=
rc
<
0
&&
mg_is_error
()
?
mg_get_errno
()
:
0
;
DBG
((
"%p sock %d rc %d errno %d err %d"
,
nc
,
nc
->
sock
,
rc
,
mg_get_errno
()
,
nc
->
err
));
DBG
((
"%p sock %d rc %d errno %d err %d"
,
nc
,
(
int
)
nc
->
sock
,
rc
,
mg_get_errno
(),
nc
->
err
));
}
void
mg_socket_if_connect_udp
(
struct
mg_connection
*
nc
)
{
...
...
@@ -103,7 +103,7 @@ static int mg_socket_if_udp_send(struct mg_connection *nc, const void *buf,
static
int
mg_socket_if_tcp_recv
(
struct
mg_connection
*
nc
,
void
*
buf
,
size_t
len
)
{
int
n
=
(
int
)
MG_RECV_FUNC
(
nc
->
sock
,
buf
,
len
,
MSG_DONTWAIT
);
int
n
=
(
int
)
MG_RECV_FUNC
(
nc
->
sock
,
buf
,
len
,
0
);
if
(
n
==
0
)
{
/* Orderly shutdown of the socket, try flushing output. */
nc
->
flags
|=
MG_F_SEND_AND_CLOSE
;
...
...
@@ -218,8 +218,8 @@ void mg_mgr_handle_conn(struct mg_connection *nc, int fd_flags, double now) {
int
worth_logging
=
fd_flags
!=
0
||
(
nc
->
flags
&
(
MG_F_WANT_READ
|
MG_F_WANT_WRITE
));
if
(
worth_logging
)
{
DBG
((
"%p fd=%d fd_flags=%d nc_flags=0x%lx rmbl=%d smbl=%d"
,
nc
,
nc
->
sock
,
fd_flags
,
nc
->
flags
,
(
int
)
nc
->
recv_mbuf
.
len
,
DBG
((
"%p fd=%d fd_flags=%d nc_flags=0x%lx rmbl=%d smbl=%d"
,
nc
,
(
int
)
nc
->
sock
,
fd_flags
,
nc
->
flags
,
(
int
)
nc
->
recv_mbuf
.
len
,
(
int
)
nc
->
send_mbuf
.
len
));
}
...
...
@@ -271,7 +271,7 @@ void mg_mgr_handle_conn(struct mg_connection *nc, int fd_flags, double now) {
if
(
fd_flags
&
_MG_F_FD_CAN_WRITE
)
mg_if_can_send_cb
(
nc
);
if
(
worth_logging
)
{
DBG
((
"%p after fd=%d nc_flags=0x%lx rmbl=%d smbl=%d"
,
nc
,
nc
->
sock
,
DBG
((
"%p after fd=%d nc_flags=0x%lx rmbl=%d smbl=%d"
,
nc
,
(
int
)
nc
->
sock
,
nc
->
flags
,
(
int
)
nc
->
recv_mbuf
.
len
,
(
int
)
nc
->
send_mbuf
.
len
));
}
}
...
...
@@ -279,8 +279,7 @@ void mg_mgr_handle_conn(struct mg_connection *nc, int fd_flags, double now) {
#if MG_ENABLE_BROADCAST
static
void
mg_mgr_handle_ctl_sock
(
struct
mg_mgr
*
mgr
)
{
struct
ctl_msg
ctl_msg
;
int
len
=
(
int
)
MG_RECV_FUNC
(
mgr
->
ctl
[
1
],
(
char
*
)
&
ctl_msg
,
sizeof
(
ctl_msg
),
MSG_DONTWAIT
);
int
len
=
(
int
)
MG_RECV_FUNC
(
mgr
->
ctl
[
1
],
(
char
*
)
&
ctl_msg
,
sizeof
(
ctl_msg
),
0
);
size_t
dummy
=
MG_SEND_FUNC
(
mgr
->
ctl
[
1
],
ctl_msg
.
message
,
1
,
0
);
DBG
((
"read %d from ctl socket"
,
len
));
(
void
)
dummy
;
/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509 */
...
...
@@ -299,7 +298,7 @@ void mg_socket_if_sock_set(struct mg_connection *nc, sock_t sock) {
mg_set_non_blocking_mode
(
sock
);
mg_set_close_on_exec
(
sock
);
nc
->
sock
=
sock
;
DBG
((
"%p %d"
,
nc
,
sock
));
DBG
((
"%p %d"
,
nc
,
(
int
)
sock
));
}
void
mg_socket_if_init
(
struct
mg_iface
*
iface
)
{
...
...
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