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
5d27f3ab
Commit
5d27f3ab
authored
Mar 16, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build messages manually, rather than going through the accumulate functions.
parent
64d82779
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
29 deletions
+18
-29
message.c
message.c
+18
-29
No files found.
message.c
View file @
5d27f3ab
...
...
@@ -425,45 +425,34 @@ start_message(struct network *net, int bytes)
flushbuf
(
net
);
}
static
void
accumulate_byte
(
struct
network
*
net
,
unsigned
char
byte
)
{
net
->
sendbuf
[
net
->
buffered
]
=
byte
;
net
->
buffered
++
;
}
static
void
accumulate_short
(
struct
network
*
net
,
unsigned
short
s
)
{
*
(
uint16_t
*
)(
net
->
sendbuf
+
net
->
buffered
)
=
htons
(
s
);
net
->
buffered
+=
2
;
}
static
void
accumulate_data
(
struct
network
*
net
,
const
unsigned
char
*
data
,
unsigned
int
len
)
{
memcpy
(
net
->
sendbuf
+
net
->
buffered
,
data
,
len
);
net
->
buffered
+=
len
;
}
static
void
send_message
(
struct
network
*
net
,
unsigned
char
type
,
unsigned
char
plen
,
unsigned
char
hop_count
,
unsigned
short
seqno
,
unsigned
short
metric
,
const
unsigned
char
*
address
)
{
unsigned
char
*
buf
;
int
n
;
if
(
!
net
->
up
)
return
;
start_message
(
net
,
24
);
accumulate_byte
(
net
,
type
);
accumulate_byte
(
net
,
plen
);
accumulate_byte
(
net
,
0
);
accumulate_byte
(
net
,
hop_count
);
accumulate_short
(
net
,
seqno
);
accumulate_short
(
net
,
metric
);
accumulate_data
(
net
,
address
,
16
);
buf
=
net
->
sendbuf
;
n
=
net
->
buffered
;
buf
[
n
++
]
=
type
;
buf
[
n
++
]
=
plen
;
buf
[
n
++
]
=
0
;
buf
[
n
++
]
=
hop_count
;
buf
[
n
++
]
=
(
seqno
>>
8
)
&
0xFF
;
buf
[
n
++
]
=
seqno
&
0xFF
;
buf
[
n
++
]
=
(
metric
>>
8
)
&
0xFF
;
buf
[
n
++
]
=
metric
&
0xFF
;
memcpy
(
buf
+
n
,
address
,
16
);
n
+=
16
;
net
->
buffered
=
n
;
schedule_flush
(
net
);
}
...
...
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