Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Goshimmer_without_tipselection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
COLLET Ismael
Goshimmer_without_tipselection
Commits
293044f9
Unverified
Commit
293044f9
authored
5 years ago
by
Levente Pap
Browse files
Options
Downloads
Patches
Plain Diff
Add comments
parent
da974700
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/analysis/packet/heartbeat.go
+2
-1
2 additions, 1 deletion
plugins/analysis/packet/heartbeat.go
with
2 additions
and
1 deletion
plugins/analysis/packet/heartbeat.go
+
2
−
1
View file @
293044f9
...
@@ -68,7 +68,7 @@ func init() {
...
@@ -68,7 +68,7 @@ func init() {
}
}
}
}
// ParseHeartbeat parses a slice of bytes into a heartbeat.
// ParseHeartbeat parses a slice of bytes
(serialized packet)
into a heartbeat.
func
ParseHeartbeat
(
data
[]
byte
)
(
*
Heartbeat
,
error
)
{
func
ParseHeartbeat
(
data
[]
byte
)
(
*
Heartbeat
,
error
)
{
// check minimum size
// check minimum size
if
len
(
data
)
<
HeartbeatPacketMinSize
{
if
len
(
data
)
<
HeartbeatPacketMinSize
{
...
@@ -129,6 +129,7 @@ func ParseHeartbeat(data []byte) (*Heartbeat, error) {
...
@@ -129,6 +129,7 @@ func ParseHeartbeat(data []byte) (*Heartbeat, error) {
}
}
// NewHeartbeatMessage serializes the given heartbeat into a byte slice and adds a tlv header to the packet.
// NewHeartbeatMessage serializes the given heartbeat into a byte slice and adds a tlv header to the packet.
// message = tlv header + serialized packet
func
NewHeartbeatMessage
(
hb
*
Heartbeat
)
([]
byte
,
error
)
{
func
NewHeartbeatMessage
(
hb
*
Heartbeat
)
([]
byte
,
error
)
{
if
len
(
hb
.
InboundIDs
)
>
HeartbeatMaxInboundPeersCount
{
if
len
(
hb
.
InboundIDs
)
>
HeartbeatMaxInboundPeersCount
{
return
nil
,
fmt
.
Errorf
(
"%w: heartbeat exceeds maximum inbound IDs of %d"
,
ErrInvalidHeartbeat
,
HeartbeatMaxInboundPeersCount
)
return
nil
,
fmt
.
Errorf
(
"%w: heartbeat exceeds maximum inbound IDs of %d"
,
ErrInvalidHeartbeat
,
HeartbeatMaxInboundPeersCount
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment