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
08e26966
Commit
08e26966
authored
Jan 21, 2015
by
Marek Kotewicz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed send queues from providermanager
parent
c9693b47
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
62 deletions
+28
-62
ethereum.js
dist/ethereum.js
+12
-29
ethereum.js.map
dist/ethereum.js.map
+3
-3
ethereum.min.js
dist/ethereum.min.js
+1
-1
providermanager.js
lib/providermanager.js
+6
-12
web3.js
lib/web3.js
+6
-17
No files found.
dist/ethereum.js
View file @
08e26966
...
...
@@ -726,17 +726,19 @@ var ProviderManager = function() {
/// sends outgoing requests, if provider is not available, enqueue the request
ProviderManager
.
prototype
.
send
=
function
(
data
)
{
data
.
_id
=
this
.
id
;
data
.
args
=
data
.
args
||
[];
this
.
id
++
;
data
.
_id
=
this
.
id
++
;
if
(
this
.
provider
===
undefined
)
{
console
.
error
(
'provider is not set'
);
return
JSON
.
stringify
({
result
:
'error, provider is not set'
})
;
return
undefined
;
}
return
this
.
provider
.
send
(
data
);
//TODO: handle error here?
var
result
=
this
.
provider
.
send
(
data
);
result
=
JSON
.
parse
(
result
);
return
result
.
result
;
};
/// setups provider, which will be used for sending messages
...
...
@@ -749,14 +751,6 @@ ProviderManager.prototype.set = function(provider) {
this
.
ready
=
true
;
};
/// resends queued messages
ProviderManager
.
prototype
.
sendQueued
=
function
()
{
for
(
var
i
=
0
;
this
.
queued
.
length
;
i
++
)
{
// Resend
this
.
send
(
this
.
queued
[
i
]);
}
};
/// @returns true if the provider i properly set
ProviderManager
.
prototype
.
installed
=
function
()
{
return
this
.
provider
!==
undefined
;
...
...
@@ -916,14 +910,10 @@ var setupMethods = function (obj, methods) {
obj
[
method
.
name
]
=
function
()
{
var
args
=
Array
.
prototype
.
slice
.
call
(
arguments
);
var
call
=
typeof
method
.
call
===
'function'
?
method
.
call
(
args
)
:
method
.
call
;
var
result
=
web3
.
provider
.
send
({
return
web3
.
provider
.
send
({
call
:
call
,
args
:
args
});
result
=
JSON
.
parse
(
result
);
return
result
.
result
;
};
});
};
...
...
@@ -934,24 +924,17 @@ var setupProperties = function (obj, properties) {
properties
.
forEach
(
function
(
property
)
{
var
proto
=
{};
proto
.
get
=
function
()
{
var
result
=
web3
.
provider
.
send
({
return
web3
.
provider
.
send
({
call
:
property
.
getter
});
result
=
JSON
.
parse
(
result
);
return
result
.
result
;
};
if
(
property
.
setter
)
{
proto
.
set
=
function
(
val
)
{
var
result
=
web3
.
provider
.
send
({
return
web3
.
provider
.
send
({
call
:
property
.
setter
,
args
:
[
val
]
});
result
=
JSON
.
parse
(
result
);
return
result
.
result
;
};
}
Object
.
defineProperty
(
obj
,
property
.
name
,
proto
);
...
...
@@ -959,6 +942,7 @@ var setupProperties = function (obj, properties) {
};
// TODO: import from a dependency, don't duplicate.
// TODO: use bignumber for that!
var
hexToDec
=
function
(
hex
)
{
return
parseInt
(
hex
,
16
).
toString
();
};
...
...
@@ -1117,9 +1101,8 @@ var shhWatch = {
setupMethods
(
shhWatch
,
shhWatchMethods
());
web3
.
setProvider
=
function
(
provider
)
{
provider
.
onmessage
=
messageHandler
;
//provider.onmessage = messageHandler; // there will be no async calls, to remove
web3
.
provider
.
set
(
provider
);
web3
.
provider
.
sendQueued
();
};
/// callled when there is new incoming message
...
...
dist/ethereum.js.map
View file @
08e26966
This diff is collapsed.
Click to expand it.
dist/ethereum.min.js
View file @
08e26966
This diff is collapsed.
Click to expand it.
lib/providermanager.js
View file @
08e26966
...
...
@@ -57,17 +57,19 @@ var ProviderManager = function() {
/// sends outgoing requests, if provider is not available, enqueue the request
ProviderManager
.
prototype
.
send
=
function
(
data
)
{
data
.
_id
=
this
.
id
;
data
.
args
=
data
.
args
||
[];
this
.
id
++
;
data
.
_id
=
this
.
id
++
;
if
(
this
.
provider
===
undefined
)
{
console
.
error
(
'provider is not set'
);
return
JSON
.
stringify
({
result
:
'error, provider is not set'
})
;
return
undefined
;
}
return
this
.
provider
.
send
(
data
);
//TODO: handle error here?
var
result
=
this
.
provider
.
send
(
data
);
result
=
JSON
.
parse
(
result
);
return
result
.
result
;
};
/// setups provider, which will be used for sending messages
...
...
@@ -80,14 +82,6 @@ ProviderManager.prototype.set = function(provider) {
this
.
ready
=
true
;
};
/// resends queued messages
ProviderManager
.
prototype
.
sendQueued
=
function
()
{
for
(
var
i
=
0
;
this
.
queued
.
length
;
i
++
)
{
// Resend
this
.
send
(
this
.
queued
[
i
]);
}
};
/// @returns true if the provider i properly set
ProviderManager
.
prototype
.
installed
=
function
()
{
return
this
.
provider
!==
undefined
;
...
...
lib/web3.js
View file @
08e26966
...
...
@@ -129,14 +129,10 @@ var setupMethods = function (obj, methods) {
obj
[
method
.
name
]
=
function
()
{
var
args
=
Array
.
prototype
.
slice
.
call
(
arguments
);
var
call
=
typeof
method
.
call
===
'function'
?
method
.
call
(
args
)
:
method
.
call
;
var
result
=
web3
.
provider
.
send
({
return
web3
.
provider
.
send
({
call
:
call
,
args
:
args
});
result
=
JSON
.
parse
(
result
);
return
result
.
result
;
};
});
};
...
...
@@ -147,24 +143,17 @@ var setupProperties = function (obj, properties) {
properties
.
forEach
(
function
(
property
)
{
var
proto
=
{};
proto
.
get
=
function
()
{
var
result
=
web3
.
provider
.
send
({
return
web3
.
provider
.
send
({
call
:
property
.
getter
});
result
=
JSON
.
parse
(
result
);
return
result
.
result
;
};
if
(
property
.
setter
)
{
proto
.
set
=
function
(
val
)
{
var
result
=
web3
.
provider
.
send
({
return
web3
.
provider
.
send
({
call
:
property
.
setter
,
args
:
[
val
]
});
result
=
JSON
.
parse
(
result
);
return
result
.
result
;
};
}
Object
.
defineProperty
(
obj
,
property
.
name
,
proto
);
...
...
@@ -172,6 +161,7 @@ var setupProperties = function (obj, properties) {
};
// TODO: import from a dependency, don't duplicate.
// TODO: use bignumber for that!
var
hexToDec
=
function
(
hex
)
{
return
parseInt
(
hex
,
16
).
toString
();
};
...
...
@@ -330,9 +320,8 @@ var shhWatch = {
setupMethods
(
shhWatch
,
shhWatchMethods
());
web3
.
setProvider
=
function
(
provider
)
{
provider
.
onmessage
=
messageHandler
;
//provider.onmessage = messageHandler; // there will be no async calls, to remove
web3
.
provider
.
set
(
provider
);
web3
.
provider
.
sendQueued
();
};
/// callled when there is new incoming message
...
...
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