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
2e3a6e25
Commit
2e3a6e25
authored
Feb 24, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consolidate related items
parent
c8e9abff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
37 deletions
+36
-37
api.go
rpc/api.go
+36
-37
No files found.
rpc/api.go
View file @
2e3a6e25
...
@@ -25,8 +25,9 @@ import (
...
@@ -25,8 +25,9 @@ import (
)
)
var
(
var
(
defaultGasPrice
=
big
.
NewInt
(
10000000000000
)
defaultGasPrice
=
big
.
NewInt
(
10000000000000
)
defaultGas
=
big
.
NewInt
(
10000
)
defaultGas
=
big
.
NewInt
(
10000
)
filterTickerTime
=
15
*
time
.
Second
)
)
type
EthereumApi
struct
{
type
EthereumApi
struct
{
...
@@ -62,6 +63,39 @@ func NewEthereumApi(eth *xeth.XEth) *EthereumApi {
...
@@ -62,6 +63,39 @@ func NewEthereumApi(eth *xeth.XEth) *EthereumApi {
return
api
return
api
}
}
func
(
self
*
EthereumApi
)
start
()
{
timer
:=
time
.
NewTicker
(
filterTickerTime
)
done
:
for
{
select
{
case
<-
timer
.
C
:
self
.
logMut
.
Lock
()
self
.
messagesMut
.
Lock
()
for
id
,
filter
:=
range
self
.
logs
{
if
time
.
Since
(
filter
.
timeout
)
>
20
*
time
.
Second
{
self
.
filterManager
.
UninstallFilter
(
id
)
delete
(
self
.
logs
,
id
)
}
}
for
id
,
filter
:=
range
self
.
messages
{
if
time
.
Since
(
filter
.
timeout
)
>
20
*
time
.
Second
{
self
.
xeth
.
Whisper
()
.
Unwatch
(
id
)
delete
(
self
.
messages
,
id
)
}
}
self
.
logMut
.
Unlock
()
self
.
messagesMut
.
Unlock
()
case
<-
self
.
quit
:
break
done
}
}
}
func
(
self
*
EthereumApi
)
stop
()
{
close
(
self
.
quit
)
}
func
(
self
*
EthereumApi
)
Register
(
args
string
,
reply
*
interface
{})
error
{
func
(
self
*
EthereumApi
)
Register
(
args
string
,
reply
*
interface
{})
error
{
self
.
regmut
.
Lock
()
self
.
regmut
.
Lock
()
defer
self
.
regmut
.
Unlock
()
defer
self
.
regmut
.
Unlock
()
...
@@ -600,38 +634,3 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
...
@@ -600,38 +634,3 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
rpclogger
.
DebugDetailf
(
"Reply: %T %s"
,
reply
,
reply
)
rpclogger
.
DebugDetailf
(
"Reply: %T %s"
,
reply
,
reply
)
return
nil
return
nil
}
}
var
filterTickerTime
=
15
*
time
.
Second
func
(
self
*
EthereumApi
)
start
()
{
timer
:=
time
.
NewTicker
(
filterTickerTime
)
done
:
for
{
select
{
case
<-
timer
.
C
:
self
.
logMut
.
Lock
()
self
.
messagesMut
.
Lock
()
for
id
,
filter
:=
range
self
.
logs
{
if
time
.
Since
(
filter
.
timeout
)
>
20
*
time
.
Second
{
self
.
filterManager
.
UninstallFilter
(
id
)
delete
(
self
.
logs
,
id
)
}
}
for
id
,
filter
:=
range
self
.
messages
{
if
time
.
Since
(
filter
.
timeout
)
>
20
*
time
.
Second
{
self
.
xeth
.
Whisper
()
.
Unwatch
(
id
)
delete
(
self
.
messages
,
id
)
}
}
self
.
logMut
.
Unlock
()
self
.
messagesMut
.
Unlock
()
case
<-
self
.
quit
:
break
done
}
}
}
func
(
self
*
EthereumApi
)
stop
()
{
close
(
self
.
quit
)
}
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