Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Matt Johnston
dropbear
Commits
8ccbd216
Commit
8ccbd216
authored
Sep 29, 2015
by
Matt Johnston
Browse files
make sure that the test for queued packets to write occurs after
those packets might have been enqueued by set_connect_fds()
parent
90f4da29
Changes
1
Hide whitespace changes
Inline
Side-by-side
common-session.c
View file @
8ccbd216
...
@@ -159,6 +159,16 @@ void session_loop(void(*loophandler)()) {
...
@@ -159,6 +159,16 @@ void session_loop(void(*loophandler)()) {
FD_ZERO
(
&
readfd
);
FD_ZERO
(
&
readfd
);
dropbear_assert
(
ses
.
payload
==
NULL
);
dropbear_assert
(
ses
.
payload
==
NULL
);
/* We get woken up when signal handlers write to this pipe.
SIGCHLD in svr-chansession is the only one currently. */
FD_SET
(
ses
.
signal_pipe
[
0
],
&
readfd
);
/* set up for channels which can be read/written */
setchannelfds
(
&
readfd
,
&
writefd
,
writequeue_has_space
);
/* Pending connections to test */
set_connect_fds
(
&
writefd
);
/* We delay reading from the input socket during initial setup until
/* We delay reading from the input socket during initial setup until
after we have written out our initial KEXINIT packet (empty writequeue).
after we have written out our initial KEXINIT packet (empty writequeue).
This means our initial packet can be in-flight while we're doing a blocking
This means our initial packet can be in-flight while we're doing a blocking
...
@@ -170,19 +180,12 @@ void session_loop(void(*loophandler)()) {
...
@@ -170,19 +180,12 @@ void session_loop(void(*loophandler)()) {
&&
writequeue_has_space
)
{
&&
writequeue_has_space
)
{
FD_SET
(
ses
.
sock_in
,
&
readfd
);
FD_SET
(
ses
.
sock_in
,
&
readfd
);
}
}
/* Ordering is important, this test must occur after any other function
might have queued packets (such as connection handlers) */
if
(
ses
.
sock_out
!=
-
1
&&
!
isempty
(
&
ses
.
writequeue
))
{
if
(
ses
.
sock_out
!=
-
1
&&
!
isempty
(
&
ses
.
writequeue
))
{
FD_SET
(
ses
.
sock_out
,
&
writefd
);
FD_SET
(
ses
.
sock_out
,
&
writefd
);
}
}
/* We get woken up when signal handlers write to this pipe.
SIGCHLD in svr-chansession is the only one currently. */
FD_SET
(
ses
.
signal_pipe
[
0
],
&
readfd
);
/* set up for channels which can be read/written */
setchannelfds
(
&
readfd
,
&
writefd
,
writequeue_has_space
);
/* Pending connections to test */
set_connect_fds
(
&
writefd
);
val
=
select
(
ses
.
maxfd
+
1
,
&
readfd
,
&
writefd
,
NULL
,
&
timeout
);
val
=
select
(
ses
.
maxfd
+
1
,
&
readfd
,
&
writefd
,
NULL
,
&
timeout
);
...
...
Write
Preview
Supports
Markdown
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