Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bio-rd
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
bio-rd
Commits
347a0694
Commit
347a0694
authored
4 years ago
by
Oliver Herms
Browse files
Options
Downloads
Patches
Plain Diff
Fix magic number
parent
08f64f4c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
routingtable/mergedlocrib/mergedlocrib.go
+7
-7
7 additions, 7 deletions
routingtable/mergedlocrib/mergedlocrib.go
with
7 additions
and
7 deletions
routingtable/mergedlocrib/mergedlocrib.go
+
7
−
7
View file @
347a0694
...
...
@@ -14,7 +14,7 @@ import (
// MergedLocRIB provides an deduplicated routing table
type
MergedLocRIB
struct
{
routes
map
[[
20
]
byte
]
*
routeContainer
routes
map
[[
sha1
.
Size
]
byte
]
*
routeContainer
routesMu
sync
.
RWMutex
locRIB
*
locRIB
.
LocRIB
}
...
...
@@ -22,7 +22,7 @@ type MergedLocRIB struct {
// New creates a new MergedLocRIB and starts it
func
New
(
locRIB
*
locRIB
.
LocRIB
)
*
MergedLocRIB
{
return
&
MergedLocRIB
{
routes
:
make
(
map
[[
20
]
byte
]
*
routeContainer
),
routes
:
make
(
map
[[
sha1
.
Size
]
byte
]
*
routeContainer
),
locRIB
:
locRIB
,
}
}
...
...
@@ -76,7 +76,7 @@ func (rtm *MergedLocRIB) RemoveRoute(cc interface{}, r *routeapi.Route) error {
return
nil
}
func
(
rtm
*
MergedLocRIB
)
_delRoute
(
h
[
20
]
byte
,
src
interface
{},
r
*
routeapi
.
Route
)
{
func
(
rtm
*
MergedLocRIB
)
_delRoute
(
h
[
sha1
.
Size
]
byte
,
src
interface
{},
r
*
routeapi
.
Route
)
{
rtm
.
routes
[
h
]
.
removeSource
(
src
)
if
rtm
.
routes
[
h
]
.
srcCount
()
>
0
{
...
...
@@ -88,18 +88,18 @@ func (rtm *MergedLocRIB) _delRoute(h [20]byte, src interface{}, r *routeapi.Rout
delete
(
rtm
.
routes
,
h
)
}
func
hashRoute
(
route
*
routeapi
.
Route
)
([
20
]
byte
,
error
)
{
func
hashRoute
(
route
*
routeapi
.
Route
)
([
sha1
.
Size
]
byte
,
error
)
{
m
,
err
:=
proto
.
Marshal
(
route
)
if
err
!=
nil
{
return
[
20
]
byte
{},
errors
.
Wrap
(
err
,
"Proto marshal failed"
)
return
[
sha1
.
Size
]
byte
{},
errors
.
Wrap
(
err
,
"Proto marshal failed"
)
}
h
:=
sha1
.
New
()
_
,
err
=
h
.
Write
(
m
)
if
err
!=
nil
{
return
[
20
]
byte
{},
errors
.
Wrap
(
err
,
"Write failed"
)
return
[
sha1
.
Size
]
byte
{},
errors
.
Wrap
(
err
,
"Write failed"
)
}
res
:=
[
20
]
byte
{}
res
:=
[
sha1
.
Size
]
byte
{}
x
:=
h
.
Sum
(
nil
)
copy
(
res
[
:
],
x
)
...
...
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