Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
208ad5db
Commit
208ad5db
authored
Oct 17, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't send messages on down networks.
parent
eb1ac22c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
message.c
message.c
+17
-1
No files found.
message.c
View file @
208ad5db
...
...
@@ -534,6 +534,9 @@ ensure_space(struct network *net, int space)
static
void
start_message
(
struct
network
*
net
,
int
type
,
int
len
)
{
if
(
!
net
->
up
)
return
;
if
(
net
->
bufsize
-
net
->
buffered
<
len
+
2
)
flushbuf
(
net
);
net
->
sendbuf
[
net
->
buffered
++
]
=
type
;
...
...
@@ -541,7 +544,11 @@ start_message(struct network *net, int type, int len)
}
static
void
end_message
(
struct
network
*
net
,
int
type
,
int
bytes
)
{
end_message
(
struct
network
*
net
,
int
type
,
int
bytes
)
{
if
(
!
net
->
up
)
return
;
assert
(
net
->
buffered
>=
bytes
+
2
&&
net
->
sendbuf
[
net
->
buffered
-
bytes
-
2
]
==
type
&&
net
->
sendbuf
[
net
->
buffered
-
bytes
-
1
]
==
bytes
);
...
...
@@ -551,12 +558,18 @@ end_message(struct network *net, int type, int bytes) {
static
void
accumulate_byte
(
struct
network
*
net
,
unsigned
char
value
)
{
if
(
!
net
->
up
)
return
;
net
->
sendbuf
[
net
->
buffered
++
]
=
value
;
}
static
void
accumulate_short
(
struct
network
*
net
,
unsigned
short
value
)
{
if
(
!
net
->
up
)
return
;
DO_HTONS
(
net
->
sendbuf
+
net
->
buffered
,
value
);
net
->
buffered
+=
2
;
}
...
...
@@ -565,6 +578,9 @@ static void
accumulate_bytes
(
struct
network
*
net
,
const
unsigned
char
*
value
,
unsigned
len
)
{
if
(
!
net
->
up
)
return
;
memcpy
(
net
->
sendbuf
+
net
->
buffered
,
value
,
len
);
net
->
buffered
+=
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