Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
1a4cfc17
Commit
1a4cfc17
authored
Apr 14, 2015
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
whisper, xeth/whisper, ui/qt/qwhispe: fix API polish breakages
parent
e2b7498c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
20 deletions
+19
-20
whisper.go
ui/qt/qwhisper/whisper.go
+2
-2
whisper.go
whisper/whisper.go
+15
-16
whisper.go
xeth/whisper.go
+2
-2
No files found.
ui/qt/qwhisper/whisper.go
View file @
1a4cfc17
...
@@ -41,7 +41,7 @@ func (self *Whisper) Post(payload []string, to, from string, topics []string, pr
...
@@ -41,7 +41,7 @@ func (self *Whisper) Post(payload []string, to, from string, topics []string, pr
TTL
:
time
.
Duration
(
ttl
)
*
time
.
Second
,
TTL
:
time
.
Duration
(
ttl
)
*
time
.
Second
,
To
:
crypto
.
ToECDSAPub
(
common
.
FromHex
(
to
)),
To
:
crypto
.
ToECDSAPub
(
common
.
FromHex
(
to
)),
From
:
key
,
From
:
key
,
Topics
:
whisper
.
TopicsFromString
(
topics
...
),
Topics
:
whisper
.
NewTopicsFromStrings
(
topics
...
),
})
})
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -106,7 +106,7 @@ func filterFromMap(opts map[string]interface{}) (f whisper.Filter) {
...
@@ -106,7 +106,7 @@ func filterFromMap(opts map[string]interface{}) (f whisper.Filter) {
if
topicList
,
ok
:=
opts
[
"topics"
]
.
(
*
qml
.
List
);
ok
{
if
topicList
,
ok
:=
opts
[
"topics"
]
.
(
*
qml
.
List
);
ok
{
var
topics
[]
string
var
topics
[]
string
topicList
.
Convert
(
&
topics
)
topicList
.
Convert
(
&
topics
)
f
.
Topics
=
whisper
.
TopicsFromString
(
topics
...
)
f
.
Topics
=
whisper
.
NewTopicsFromStrings
(
topics
...
)
}
}
return
return
...
...
whisper/whisper.go
View file @
1a4cfc17
...
@@ -144,6 +144,21 @@ func (self *Whisper) Stop() {
...
@@ -144,6 +144,21 @@ func (self *Whisper) Stop() {
glog
.
V
(
logger
.
Info
)
.
Infoln
(
"Whisper stopped"
)
glog
.
V
(
logger
.
Info
)
.
Infoln
(
"Whisper stopped"
)
}
}
// Messages retrieves the currently pooled messages matching a filter id.
func
(
self
*
Whisper
)
Messages
(
id
int
)
[]
*
Message
{
messages
:=
make
([]
*
Message
,
0
)
if
filter
:=
self
.
filters
.
Get
(
id
);
filter
!=
nil
{
for
_
,
envelope
:=
range
self
.
messages
{
if
message
:=
self
.
open
(
envelope
);
message
!=
nil
{
if
self
.
filters
.
Match
(
filter
,
createFilter
(
message
,
envelope
.
Topics
))
{
messages
=
append
(
messages
,
message
)
}
}
}
}
return
messages
}
// func (self *Whisper) RemoveIdentity(key *ecdsa.PublicKey) bool {
// func (self *Whisper) RemoveIdentity(key *ecdsa.PublicKey) bool {
// k := string(crypto.FromECDSAPub(key))
// k := string(crypto.FromECDSAPub(key))
// if _, ok := self.keys[k]; ok {
// if _, ok := self.keys[k]; ok {
...
@@ -153,22 +168,6 @@ func (self *Whisper) Stop() {
...
@@ -153,22 +168,6 @@ func (self *Whisper) Stop() {
// return false
// return false
// }
// }
/*func (self *Whisper) Messages(id int) (messages []*Message) {
filter := self.filters.Get(id)
if filter != nil {
for _, e := range self.messages {
if msg := self.open(e); msg != nil {
f := createFilter(msg, e.Topics)
if self.filters.Match(filter, f) {
messages = append(messages, msg)
}
}
}
}
return
}*/
// handlePeer is called by the underlying P2P layer when the whisper sub-protocol
// handlePeer is called by the underlying P2P layer when the whisper sub-protocol
// connection is negotiated.
// connection is negotiated.
func
(
self
*
Whisper
)
handlePeer
(
peer
*
p2p
.
Peer
,
rw
p2p
.
MsgReadWriter
)
error
{
func
(
self
*
Whisper
)
handlePeer
(
peer
*
p2p
.
Peer
,
rw
p2p
.
MsgReadWriter
)
error
{
...
...
xeth/whisper.go
View file @
1a4cfc17
...
@@ -36,7 +36,7 @@ func (self *Whisper) Post(payload string, to, from string, topics []string, prio
...
@@ -36,7 +36,7 @@ func (self *Whisper) Post(payload string, to, from string, topics []string, prio
TTL
:
time
.
Duration
(
ttl
)
*
time
.
Second
,
TTL
:
time
.
Duration
(
ttl
)
*
time
.
Second
,
To
:
crypto
.
ToECDSAPub
(
common
.
FromHex
(
to
)),
To
:
crypto
.
ToECDSAPub
(
common
.
FromHex
(
to
)),
From
:
key
,
From
:
key
,
Topics
:
whisper
.
TopicsFromString
(
topics
...
),
Topics
:
whisper
.
NewTopicsFromStrings
(
topics
...
),
})
})
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -71,7 +71,7 @@ func (self *Whisper) Watch(opts *Options) int {
...
@@ -71,7 +71,7 @@ func (self *Whisper) Watch(opts *Options) int {
filter
:=
whisper
.
Filter
{
filter
:=
whisper
.
Filter
{
To
:
crypto
.
ToECDSAPub
(
common
.
FromHex
(
opts
.
To
)),
To
:
crypto
.
ToECDSAPub
(
common
.
FromHex
(
opts
.
To
)),
From
:
crypto
.
ToECDSAPub
(
common
.
FromHex
(
opts
.
From
)),
From
:
crypto
.
ToECDSAPub
(
common
.
FromHex
(
opts
.
From
)),
Topics
:
whisper
.
TopicsFromString
(
opts
.
Topics
...
),
Topics
:
whisper
.
NewTopicsFromStrings
(
opts
.
Topics
...
),
}
}
var
i
int
var
i
int
...
...
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