Skip to content

Commit

Permalink
change from field to bytes to avoid json marshalling corruption
Browse files Browse the repository at this point in the history
  • Loading branch information
whyrusleeping committed Jan 9, 2017
1 parent a5b52ed commit 25ef943
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions floodsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
},
}
Expand Down
10 changes: 5 additions & 5 deletions pb/rpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pb/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ message RPC {
}

message Message {
optional string from = 1;

This comment has been minimized.

Copy link
@daviddias

daviddias Nov 19, 2017

Member

@whyrusleeping this does change things for JS, we had this issue in the past (see https://github.com/ipfs/js-ipfs-bitswap/blob/master/src/types/message/message.proto.js#L9).

Can I ask you to always update me on changes on the wire protocol?

This comment has been minimized.

Copy link
@whyrusleeping

whyrusleeping Nov 20, 2017

Author Contributor

@diasdavid you told me to make this change.

This comment has been minimized.

Copy link
@daviddias

daviddias Nov 20, 2017

Member

I've no memory of that conversation, sorry then. The ask is still valid, let's keep pinging each other about wire changes

This comment has been minimized.

Copy link
@Kubuxu

Kubuxu Nov 21, 2017

Member

As a note, this is not really a wire change. On while string and bytes values are encoded exactly the same. The difference how are they latter interpreted by the language.

optional bytes from = 1;
optional bytes data = 2;
optional bytes seqno = 3;
repeated string topicIDs = 4;
Expand Down

0 comments on commit 25ef943

Please sign in to comment.