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-dms3
Commits
9849794b
Commit
9849794b
authored
10 years ago
by
Juan Batiz-Benet
Committed by
Brian Tiger Chow
10 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Sender interface to network pkg
@perfmode sender is exactly what we need to pass in to dht/bitswap.
parent
c7148cd8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
12 deletions
+15
-12
bitswap/transmission/service_wrapper.go
bitswap/transmission/service_wrapper.go
+3
-1
net/interface.go
net/interface.go
+12
-0
net/service/interface.go
net/service/interface.go
+0
-11
No files found.
bitswap/transmission/service_wrapper.go
View file @
9849794b
...
...
@@ -4,11 +4,13 @@ import (
context
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
bsmsg
"github.com/jbenet/go-ipfs/bitswap/message"
inet
"github.com/jbenet/go-ipfs/net"
netmsg
"github.com/jbenet/go-ipfs/net/message"
netservice
"github.com/jbenet/go-ipfs/net/service"
peer
"github.com/jbenet/go-ipfs/peer"
)
// NewServiceWrapper handles protobuf marshalling
func
NewServiceWrapper
(
ctx
context
.
Context
,
r
Receiver
)
Sender
{
h
:=
&
handlerWrapper
{
r
}
s
:=
netservice
.
NewService
(
h
)
...
...
@@ -49,7 +51,7 @@ func (wrapper *handlerWrapper) HandleMessage(
}
type
senderWrapper
struct
{
serviceDelegate
net
service
.
Sender
serviceDelegate
i
net
.
Sender
}
func
(
wrapper
*
senderWrapper
)
SendMessage
(
...
...
This diff is collapsed.
Click to expand it.
net/interface.go
View file @
9849794b
...
...
@@ -4,6 +4,8 @@ import (
msg
"github.com/jbenet/go-ipfs/net/message"
mux
"github.com/jbenet/go-ipfs/net/mux"
peer
"github.com/jbenet/go-ipfs/peer"
context
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
)
// Network is the interface IPFS uses for connecting to the world.
...
...
@@ -31,3 +33,13 @@ type Network interface {
// Close terminates all network operation
Close
()
error
}
// Sender interface for network services.
type
Sender
interface
{
// SendMessage sends out a given message, without expecting a response.
SendMessage
(
ctx
context
.
Context
,
m
msg
.
NetMessage
)
error
// SendRequest sends out a given message, and awaits a response.
// Set Deadlines or cancellations in the context.Context you pass in.
SendRequest
(
ctx
context
.
Context
,
m
msg
.
NetMessage
)
(
msg
.
NetMessage
,
error
)
}
This diff is collapsed.
Click to expand it.
net/service/interface.go
deleted
100644 → 0
View file @
c7148cd8
package
service
import
(
context
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
msg
"github.com/jbenet/go-ipfs/net/message"
)
type
Sender
interface
{
SendMessage
(
ctx
context
.
Context
,
m
msg
.
NetMessage
,
rid
RequestID
)
error
SendRequest
(
ctx
context
.
Context
,
m
msg
.
NetMessage
)
(
msg
.
NetMessage
,
error
)
}
This diff is collapsed.
Click to expand it.
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