Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-bitswap
Commits
d905de22
Commit
d905de22
authored
Jan 24, 2015
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove prefix logger
parent
6cd6b377
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
27 deletions
+0
-27
bitswap.go
bitswap.go
+0
-12
decision/engine.go
decision/engine.go
+0
-4
network/ipfs_impl.go
network/ipfs_impl.go
+0
-11
No files found.
bitswap.go
View file @
d905de22
...
@@ -173,10 +173,6 @@ func (bs *bitswap) sendWantlistMsgToPeers(ctx context.Context, m bsmsg.BitSwapMe
...
@@ -173,10 +173,6 @@ func (bs *bitswap) sendWantlistMsgToPeers(ctx context.Context, m bsmsg.BitSwapMe
panic
(
"Cant send wantlist to nil peerchan"
)
panic
(
"Cant send wantlist to nil peerchan"
)
}
}
log
:=
log
.
Prefix
(
"bitswap(%s).sendWantlistMsgToPeers(%d)"
,
bs
.
self
,
len
(
m
.
Wantlist
()))
log
.
Debugf
(
"begin"
)
defer
log
.
Debugf
(
"end"
)
set
:=
pset
.
New
()
set
:=
pset
.
New
()
wg
:=
sync
.
WaitGroup
{}
wg
:=
sync
.
WaitGroup
{}
for
peerToQuery
:=
range
peers
{
for
peerToQuery
:=
range
peers
{
...
@@ -216,10 +212,6 @@ func (bs *bitswap) sendWantlistToProviders(ctx context.Context) {
...
@@ -216,10 +212,6 @@ func (bs *bitswap) sendWantlistToProviders(ctx context.Context) {
return
return
}
}
log
:=
log
.
Prefix
(
"bitswap(%s).sendWantlistToProviders "
,
bs
.
self
)
log
.
Debugf
(
"begin"
)
defer
log
.
Debugf
(
"end"
)
ctx
,
cancel
:=
context
.
WithCancel
(
ctx
)
ctx
,
cancel
:=
context
.
WithCancel
(
ctx
)
defer
cancel
()
defer
cancel
()
...
@@ -233,9 +225,6 @@ func (bs *bitswap) sendWantlistToProviders(ctx context.Context) {
...
@@ -233,9 +225,6 @@ func (bs *bitswap) sendWantlistToProviders(ctx context.Context) {
go
func
(
k
u
.
Key
)
{
go
func
(
k
u
.
Key
)
{
defer
wg
.
Done
()
defer
wg
.
Done
()
log
:=
log
.
Prefix
(
"(entry: %s) "
,
k
)
log
.
Debug
(
"asking dht for providers"
)
child
,
_
:=
context
.
WithTimeout
(
ctx
,
providerRequestTimeout
)
child
,
_
:=
context
.
WithTimeout
(
ctx
,
providerRequestTimeout
)
providers
:=
bs
.
network
.
FindProvidersAsync
(
child
,
k
,
maxProvidersPerRequest
)
providers
:=
bs
.
network
.
FindProvidersAsync
(
child
,
k
,
maxProvidersPerRequest
)
for
prov
:=
range
providers
{
for
prov
:=
range
providers
{
...
@@ -257,7 +246,6 @@ func (bs *bitswap) sendWantlistToProviders(ctx context.Context) {
...
@@ -257,7 +246,6 @@ func (bs *bitswap) sendWantlistToProviders(ctx context.Context) {
}
}
func
(
bs
*
bitswap
)
taskWorker
(
ctx
context
.
Context
)
{
func
(
bs
*
bitswap
)
taskWorker
(
ctx
context
.
Context
)
{
log
:=
log
.
Prefix
(
"bitswap(%s).taskWorker"
,
bs
.
self
)
for
{
for
{
select
{
select
{
case
<-
ctx
.
Done
()
:
case
<-
ctx
.
Done
()
:
...
...
decision/engine.go
View file @
d905de22
...
@@ -163,10 +163,6 @@ func (e *Engine) MessageReceived(p peer.ID, m bsmsg.BitSwapMessage) error {
...
@@ -163,10 +163,6 @@ func (e *Engine) MessageReceived(p peer.ID, m bsmsg.BitSwapMessage) error {
e
.
lock
.
Lock
()
e
.
lock
.
Lock
()
defer
e
.
lock
.
Unlock
()
defer
e
.
lock
.
Unlock
()
log
:=
log
.
Prefix
(
"bitswap.Engine.MessageReceived(%s)"
,
p
)
log
.
Debugf
(
"enter. %d entries %d blocks"
,
len
(
m
.
Wantlist
()),
len
(
m
.
Blocks
()))
defer
log
.
Debugf
(
"exit"
)
if
len
(
m
.
Wantlist
())
==
0
&&
len
(
m
.
Blocks
())
==
0
{
if
len
(
m
.
Wantlist
())
==
0
&&
len
(
m
.
Blocks
())
==
0
{
log
.
Info
(
"superfluous message"
)
log
.
Info
(
"superfluous message"
)
}
}
...
...
network/ipfs_impl.go
View file @
d905de22
...
@@ -39,28 +39,23 @@ func (bsnet *impl) SendMessage(
...
@@ -39,28 +39,23 @@ func (bsnet *impl) SendMessage(
p
peer
.
ID
,
p
peer
.
ID
,
outgoing
bsmsg
.
BitSwapMessage
)
error
{
outgoing
bsmsg
.
BitSwapMessage
)
error
{
log
:=
log
.
Prefix
(
"bitswap net SendMessage to %s"
,
p
)
// ensure we're connected
// ensure we're connected
//TODO(jbenet) move this into host.NewStream?
//TODO(jbenet) move this into host.NewStream?
if
err
:=
bsnet
.
host
.
Connect
(
ctx
,
peer
.
PeerInfo
{
ID
:
p
});
err
!=
nil
{
if
err
:=
bsnet
.
host
.
Connect
(
ctx
,
peer
.
PeerInfo
{
ID
:
p
});
err
!=
nil
{
return
err
return
err
}
}
log
.
Debug
(
"opening stream"
)
s
,
err
:=
bsnet
.
host
.
NewStream
(
ProtocolBitswap
,
p
)
s
,
err
:=
bsnet
.
host
.
NewStream
(
ProtocolBitswap
,
p
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
defer
s
.
Close
()
defer
s
.
Close
()
log
.
Debug
(
"sending"
)
if
err
:=
outgoing
.
ToNet
(
s
);
err
!=
nil
{
if
err
:=
outgoing
.
ToNet
(
s
);
err
!=
nil
{
log
.
Errorf
(
"error: %s"
,
err
)
log
.
Errorf
(
"error: %s"
,
err
)
return
err
return
err
}
}
log
.
Debug
(
"sent"
)
return
err
return
err
}
}
...
@@ -69,35 +64,29 @@ func (bsnet *impl) SendRequest(
...
@@ -69,35 +64,29 @@ func (bsnet *impl) SendRequest(
p
peer
.
ID
,
p
peer
.
ID
,
outgoing
bsmsg
.
BitSwapMessage
)
(
bsmsg
.
BitSwapMessage
,
error
)
{
outgoing
bsmsg
.
BitSwapMessage
)
(
bsmsg
.
BitSwapMessage
,
error
)
{
log
:=
log
.
Prefix
(
"bitswap net SendRequest to %s"
,
p
)
// ensure we're connected
// ensure we're connected
//TODO(jbenet) move this into host.NewStream?
//TODO(jbenet) move this into host.NewStream?
if
err
:=
bsnet
.
host
.
Connect
(
ctx
,
peer
.
PeerInfo
{
ID
:
p
});
err
!=
nil
{
if
err
:=
bsnet
.
host
.
Connect
(
ctx
,
peer
.
PeerInfo
{
ID
:
p
});
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
log
.
Debug
(
"opening stream"
)
s
,
err
:=
bsnet
.
host
.
NewStream
(
ProtocolBitswap
,
p
)
s
,
err
:=
bsnet
.
host
.
NewStream
(
ProtocolBitswap
,
p
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
defer
s
.
Close
()
defer
s
.
Close
()
log
.
Debug
(
"sending"
)
if
err
:=
outgoing
.
ToNet
(
s
);
err
!=
nil
{
if
err
:=
outgoing
.
ToNet
(
s
);
err
!=
nil
{
log
.
Errorf
(
"error: %s"
,
err
)
log
.
Errorf
(
"error: %s"
,
err
)
return
nil
,
err
return
nil
,
err
}
}
log
.
Debug
(
"sent, now receiveing"
)
incoming
,
err
:=
bsmsg
.
FromNet
(
s
)
incoming
,
err
:=
bsmsg
.
FromNet
(
s
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Errorf
(
"error: %s"
,
err
)
log
.
Errorf
(
"error: %s"
,
err
)
return
incoming
,
err
return
incoming
,
err
}
}
log
.
Debug
(
"received"
)
return
incoming
,
nil
return
incoming
,
nil
}
}
...
...
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