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
p2p
go-p2p-pubsub
Commits
25ef943e
Commit
25ef943e
authored
Jan 09, 2017
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change from field to bytes to avoid json marshalling corruption
parent
a5b52ed0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
8 deletions
+7
-8
floodsub.go
floodsub.go
+1
-2
pb/rpc.pb.go
pb/rpc.pb.go
+5
-5
pb/rpc.proto
pb/rpc.proto
+1
-1
No files found.
floodsub.go
View file @
25ef943e
...
...
@@ -8,7 +8,6 @@ import (
pb
"github.com/libp2p/go-floodsub/pb"
proto
"github.com/gogo/protobuf/proto"
logging
"github.com/ipfs/go-log"
host
"github.com/libp2p/go-libp2p-host"
inet
"github.com/libp2p/go-libp2p-net"
...
...
@@ -401,7 +400,7 @@ func (p *PubSub) Publish(topic string, data []byte) error {
&
pb
.
Message
{
Data
:
data
,
TopicIDs
:
[]
string
{
topic
},
From
:
proto
.
String
(
string
(
p
.
host
.
ID
())
)
,
From
:
[]
byte
(
p
.
host
.
ID
()),
Seqno
:
seqno
,
},
}
...
...
pb/rpc.pb.go
View file @
25ef943e
...
...
@@ -145,7 +145,7 @@ func (m *RPC_SubOpts) GetTopicid() string {
}
type
Message
struct
{
From
*
string
`protobuf:"bytes,1,opt,name=from" json:"from,omitempty"`
From
[]
byte
`protobuf:"bytes,1,opt,name=from" json:"from,omitempty"`
Data
[]
byte
`protobuf:"bytes,2,opt,name=data" json:"data,omitempty"`
Seqno
[]
byte
`protobuf:"bytes,3,opt,name=seqno" json:"seqno,omitempty"`
TopicIDs
[]
string
`protobuf:"bytes,4,rep,name=topicIDs" json:"topicIDs,omitempty"`
...
...
@@ -156,11 +156,11 @@ func (m *Message) Reset() { *m = Message{} }
func
(
m
*
Message
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
Message
)
ProtoMessage
()
{}
func
(
m
*
Message
)
GetFrom
()
string
{
if
m
!=
nil
&&
m
.
From
!=
nil
{
return
*
m
.
From
func
(
m
*
Message
)
GetFrom
()
[]
byte
{
if
m
!=
nil
{
return
m
.
From
}
return
""
return
nil
}
func
(
m
*
Message
)
GetData
()
[]
byte
{
...
...
pb/rpc.proto
View file @
25ef943e
...
...
@@ -11,7 +11,7 @@ message RPC {
}
message
Message
{
optional
string
from
=
1
;
optional
bytes
from
=
1
;
optional
bytes
data
=
2
;
optional
bytes
seqno
=
3
;
repeated
string
topicIDs
=
4
;
...
...
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