good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
open
bor
Commits
dcca66bc
Commit
dcca66bc
authored
Jun 7, 2018
by
Andrey Petrov
Browse files
Options
Downloads
Patches
Plain Diff
p2p: Cache inbound flag on Peer.isInbound to avoid a race
parent
399aa710
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
p2p/peer.go
+14
-12
14 additions, 12 deletions
p2p/peer.go
with
14 additions
and
12 deletions
p2p/peer.go
+
14
−
12
View file @
dcca66bc
...
...
@@ -96,6 +96,7 @@ type PeerEvent struct {
// Peer represents a connected remote node.
type
Peer
struct
{
rw
*
conn
isInbound
bool
// Cached from rw.flags to avoid a race condition
running
map
[
string
]
*
protoRW
log
log
.
Logger
created
mclock
.
AbsTime
...
...
@@ -160,13 +161,14 @@ func (p *Peer) String() string {
// Inbound returns true if the peer is an inbound connection
func
(
p
*
Peer
)
Inbound
()
bool
{
return
p
.
rw
.
flags
&
inboundConn
!=
0
return
p
.
isInbound
}
func
newPeer
(
conn
*
conn
,
protocols
[]
Protocol
)
*
Peer
{
protomap
:=
matchProtocols
(
protocols
,
conn
.
caps
,
conn
)
p
:=
&
Peer
{
rw
:
conn
,
isInbound
:
conn
.
is
(
inboundConn
),
running
:
protomap
,
created
:
mclock
.
Now
(),
disc
:
make
(
chan
DiscReason
),
...
...
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