Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
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
liblongpath
liblongpath-rsync
Commits
08c88178
Commit
08c88178
authored
Dec 08, 2005
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweaked the msg_list code so that the head and tail pointers
are contained by a structure.
parent
0fb2fc4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
+20
-17
io.c
io.c
+20
-17
No files found.
io.c
View file @
08c88178
...
...
@@ -119,14 +119,17 @@ struct flist_ndx_list {
static
struct
flist_ndx_list
redo_list
,
hlink_list
;
struct
msg_list
{
struct
msg_list
*
next
;
struct
msg_list
_item
{
struct
msg_list
_item
*
next
;
char
*
buf
;
int
len
;
};
static
struct
msg_list
*
msg_list_head
;
static
struct
msg_list
*
msg_list_tail
;
struct
msg_list
{
struct
msg_list_item
*
head
,
*
tail
;
};
static
struct
msg_list
msg_list
;
static
void
flist_ndx_push
(
struct
flist_ndx_list
*
lp
,
int
ndx
)
{
...
...
@@ -224,9 +227,9 @@ void set_msg_fd_out(int fd)
/* Add a message to the pending MSG_* list. */
static
void
msg_list_add
(
int
code
,
char
*
buf
,
int
len
)
{
struct
msg_list
*
ml
;
struct
msg_list
_item
*
ml
;
if
(
!
(
ml
=
new
(
struct
msg_list
)))
if
(
!
(
ml
=
new
(
struct
msg_list
_item
)))
out_of_memory
(
"msg_list_add"
);
ml
->
next
=
NULL
;
if
(
!
(
ml
->
buf
=
new_array
(
char
,
len
+
4
)))
...
...
@@ -234,11 +237,11 @@ static void msg_list_add(int code, char *buf, int len)
SIVAL
(
ml
->
buf
,
0
,
((
code
+
MPLEX_BASE
)
<<
24
)
|
len
);
memcpy
(
ml
->
buf
+
4
,
buf
,
len
);
ml
->
len
=
len
+
4
;
if
(
msg_list
_
tail
)
msg_list
_
tail
->
next
=
ml
;
if
(
msg_list
.
tail
)
msg_list
.
tail
->
next
=
ml
;
else
msg_list
_
head
=
ml
;
msg_list
_
tail
=
ml
;
msg_list
.
head
=
ml
;
msg_list
.
tail
=
ml
;
}
void
send_msg
(
enum
msgcode
code
,
char
*
buf
,
int
len
)
...
...
@@ -339,8 +342,8 @@ int msg_list_push(int flush_it_all)
if
(
msg_fd_out
<
0
)
return
-
1
;
while
(
msg_list
_
head
)
{
struct
msg_list
*
ml
=
msg_list_
head
;
while
(
msg_list
.
head
)
{
struct
msg_list
_item
*
ml
=
msg_list
.
head
;
int
n
=
write
(
msg_fd_out
,
ml
->
buf
+
written
,
ml
->
len
-
written
);
if
(
n
<
0
)
{
if
(
errno
==
EINTR
)
...
...
@@ -357,9 +360,9 @@ int msg_list_push(int flush_it_all)
check_timeout
();
}
else
if
((
written
+=
n
)
==
ml
->
len
)
{
free
(
ml
->
buf
);
msg_list
_
head
=
ml
->
next
;
if
(
!
msg_list
_
head
)
msg_list
_
tail
=
NULL
;
msg_list
.
head
=
ml
->
next
;
if
(
!
msg_list
.
head
)
msg_list
.
tail
=
NULL
;
free
(
ml
);
written
=
0
;
}
...
...
@@ -462,7 +465,7 @@ static int read_timeout(int fd, char *buf, size_t len)
FD_ZERO
(
&
r_fds
);
FD_ZERO
(
&
w_fds
);
FD_SET
(
fd
,
&
r_fds
);
if
(
msg_list
_
head
)
{
if
(
msg_list
.
head
)
{
FD_SET
(
msg_fd_out
,
&
w_fds
);
if
(
msg_fd_out
>
maxfd
)
maxfd
=
msg_fd_out
;
...
...
@@ -499,7 +502,7 @@ static int read_timeout(int fd, char *buf, size_t len)
continue
;
}
if
(
msg_list
_
head
&&
FD_ISSET
(
msg_fd_out
,
&
w_fds
))
if
(
msg_list
.
head
&&
FD_ISSET
(
msg_fd_out
,
&
w_fds
))
msg_list_push
(
NORMAL_FLUSH
);
if
(
io_filesfrom_f_out
>=
0
)
{
...
...
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