Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
480a0631
Commit
480a0631
authored
Apr 29, 2022
by
Antoine Kaufmann
Browse files
dist/sockets: two fixes after refactor
fixes corrupted intro message and re-enables build of proxy in all target.
parent
ce1e69dd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
6 deletions
+9
-6
dist/common/base.c
dist/common/base.c
+6
-3
dist/rules.mk
dist/rules.mk
+2
-2
dist/sockets/net_sockets.c
dist/sockets/net_sockets.c
+1
-1
No files found.
dist/common/base.c
View file @
480a0631
...
@@ -350,17 +350,19 @@ int BasePeerEvent(struct Peer *peer, uint32_t events) {
...
@@ -350,17 +350,19 @@ int BasePeerEvent(struct Peer *peer, uint32_t events) {
}
}
// receive intro message
// receive intro message
ssize_t
ret
;
if
(
!
peer
->
is_listener
)
{
if
(
!
peer
->
is_listener
)
{
/* not a listener, so we're expecting an fd for the shm region */
/* not a listener, so we're expecting an fd for the shm region */
if
(
UxsocketRecvFd
(
peer
->
sock_fd
,
peer
->
intro_local
,
ret
=
UxsocketRecvFd
(
peer
->
sock_fd
,
peer
->
intro_local
,
sizeof
(
peer
->
intro_local
),
&
peer
->
shm_fd
))
sizeof
(
peer
->
intro_local
),
&
peer
->
shm_fd
);
if
(
ret
<=
0
)
return
1
;
return
1
;
if
(
!
(
peer
->
shm_base
=
ShmMap
(
peer
->
shm_fd
,
&
peer
->
shm_size
)))
if
(
!
(
peer
->
shm_base
=
ShmMap
(
peer
->
shm_fd
,
&
peer
->
shm_size
)))
return
1
;
return
1
;
}
else
{
}
else
{
/* as a listener, we use our local shm region, so no fd is sent to us */
/* as a listener, we use our local shm region, so no fd is sent to us */
ssize_t
ret
=
recv
(
peer
->
sock_fd
,
peer
->
intro_local
,
ret
=
recv
(
peer
->
sock_fd
,
peer
->
intro_local
,
sizeof
(
peer
->
intro_local
),
0
);
sizeof
(
peer
->
intro_local
),
0
);
if
(
ret
<=
0
)
{
if
(
ret
<=
0
)
{
perror
(
"PeerEvent: recv failed"
);
perror
(
"PeerEvent: recv failed"
);
...
@@ -368,6 +370,7 @@ int BasePeerEvent(struct Peer *peer, uint32_t events) {
...
@@ -368,6 +370,7 @@ int BasePeerEvent(struct Peer *peer, uint32_t events) {
}
}
}
}
peer
->
intro_local_len
=
ret
;
peer
->
intro_valid_local
=
true
;
peer
->
intro_valid_local
=
true
;
// pass intro along
// pass intro along
...
...
dist/rules.mk
View file @
480a0631
...
@@ -35,9 +35,9 @@ $(bin_net_sockets): $(SOCKETS_OBJS) $(COMMON_OBJS) -lpthread
...
@@ -35,9 +35,9 @@ $(bin_net_sockets): $(SOCKETS_OBJS) $(COMMON_OBJS) -lpthread
CLEAN
:=
$(bin_net_rdma)
$(bin_net_sockets)
\
CLEAN
:=
$(bin_net_rdma)
$(bin_net_sockets)
\
$(RDMA_OBJS)
$(SOCKETS_OBJS)
$(COMMON_OBJS)
$(RDMA_OBJS)
$(SOCKETS_OBJS)
$(COMMON_OBJS)
ALL
:=
ALL
:=
$(bin_net_sockets)
ifeq
($(ENABLE_DIST),y)
ifeq
($(ENABLE_DIST),y)
ALL
+=
$(bin_net_sockets)
$(bin_net_rdma)
ALL
+=
$(bin_net_rdma)
endif
endif
include
mk/subdir_post.mk
include
mk/subdir_post.mk
dist/sockets/net_sockets.c
View file @
480a0631
...
@@ -488,7 +488,7 @@ int BaseOpPassIntro(struct Peer *peer) {
...
@@ -488,7 +488,7 @@ int BaseOpPassIntro(struct Peer *peer) {
if
(
!
msg
)
if
(
!
msg
)
return
1
;
return
1
;
msg
->
msg_len
=
offsetof
(
struct
SockMsg
,
e
ntr
ies
.
data
)
+
peer
->
intro_local_len
;
msg
->
msg_len
=
offsetof
(
struct
SockMsg
,
i
ntr
o
.
data
)
+
peer
->
intro_local_len
;
msg
->
id
=
peer
-
peers
;
msg
->
id
=
peer
-
peers
;
msg
->
msg_type
=
kMsgIntro
;
msg
->
msg_type
=
kMsgIntro
;
msg
->
intro
.
payload_len
=
peer
->
intro_local_len
;
msg
->
intro
.
payload_len
=
peer
->
intro_local_len
;
...
...
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