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
c8a8aa0d
Commit
c8a8aa0d
authored
Jan 18, 2015
by
Viktor Trón
Committed by
Felix Lange
Feb 5, 2015
Browse files
Options
Downloads
Patches
Plain Diff
initial hook for crypto handshake (void, off by default)
parent
6b5f2580
No related branches found
No related tags found
Loading
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
p2p/peer.go
+26
-0
26 additions, 0 deletions
p2p/peer.go
with
26 additions
and
0 deletions
p2p/peer.go
+
26
−
0
View file @
c8a8aa0d
...
@@ -70,6 +70,7 @@ type Peer struct {
...
@@ -70,6 +70,7 @@ type Peer struct {
// These fields maintain the running protocols.
// These fields maintain the running protocols.
protocols
[]
Protocol
protocols
[]
Protocol
runBaseProtocol
bool
// for testing
runBaseProtocol
bool
// for testing
cryptoHandshake
bool
// for testing
runlock
sync
.
RWMutex
// protects running
runlock
sync
.
RWMutex
// protects running
running
map
[
string
]
*
proto
running
map
[
string
]
*
proto
...
@@ -141,6 +142,20 @@ func (p *Peer) Identity() ClientIdentity {
...
@@ -141,6 +142,20 @@ func (p *Peer) Identity() ClientIdentity {
return
p
.
identity
return
p
.
identity
}
}
func
(
self
*
Peer
)
Pubkey
()
(
pubkey
[]
byte
)
{
self
.
infolock
.
Lock
()
defer
self
.
infolock
.
Unlock
()
switch
{
case
self
.
identity
!=
nil
:
pubkey
=
self
.
identity
.
Pubkey
()
case
self
.
dialAddr
!=
nil
:
pubkey
=
self
.
dialAddr
.
Pubkey
case
self
.
listenAddr
!=
nil
:
pubkey
=
self
.
listenAddr
.
Pubkey
}
return
}
// Caps returns the capabilities (supported subprotocols) of the remote peer.
// Caps returns the capabilities (supported subprotocols) of the remote peer.
func
(
p
*
Peer
)
Caps
()
[]
Cap
{
func
(
p
*
Peer
)
Caps
()
[]
Cap
{
p
.
infolock
.
Lock
()
p
.
infolock
.
Lock
()
...
@@ -207,6 +222,12 @@ func (p *Peer) loop() (reason DiscReason, err error) {
...
@@ -207,6 +222,12 @@ func (p *Peer) loop() (reason DiscReason, err error) {
defer
close
(
p
.
closed
)
defer
close
(
p
.
closed
)
defer
p
.
conn
.
Close
()
defer
p
.
conn
.
Close
()
if
p
.
cryptoHandshake
{
if
err
:=
p
.
handleCryptoHandshake
();
err
!=
nil
{
return
DiscProtocolError
,
err
// no graceful disconnect
}
}
// read loop
// read loop
readMsg
:=
make
(
chan
Msg
)
readMsg
:=
make
(
chan
Msg
)
readErr
:=
make
(
chan
error
)
readErr
:=
make
(
chan
error
)
...
@@ -307,6 +328,11 @@ func (p *Peer) dispatch(msg Msg, protoDone chan struct{}) (wait bool, err error)
...
@@ -307,6 +328,11 @@ func (p *Peer) dispatch(msg Msg, protoDone chan struct{}) (wait bool, err error)
return
wait
,
nil
return
wait
,
nil
}
}
func
(
p
*
Peer
)
handleCryptoHandshake
()
(
err
error
)
{
return
nil
}
func
(
p
*
Peer
)
startBaseProtocol
()
{
func
(
p
*
Peer
)
startBaseProtocol
()
{
p
.
runlock
.
Lock
()
p
.
runlock
.
Lock
()
defer
p
.
runlock
.
Unlock
()
defer
p
.
runlock
.
Unlock
()
...
...
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