Overview
Comment: | More stats work |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
008bdd4f8f9967a25fb30b3e1fc78253 |
User & Date: | rkeene on 2019-01-17 01:57:44 |
Other Links: | manifest | tags |
Context
2019-01-17
| ||
02:19 | Better prompt handling without readline check-in: 1a36ac65ca user: rkeene tags: trunk | |
01:57 | More stats work check-in: 008bdd4f8f user: rkeene tags: trunk | |
01:55 | Support using OS resolvers check-in: d5ffbea19a user: rkeene tags: trunk | |
Changes
Modified nano.tcl from [2645fe4623] to [4d60af78c2].
︙ | ︙ | |||
3344 3345 3346 3347 3348 3349 3350 | #puts "Querying $peerSock with node_id_handshake (1)" ::nano::network::client $peerSock "node_id_handshake" query -query $node_id_nonce } } } # Stats | | | 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 | #puts "Querying $peerSock with node_id_handshake (1)" ::nano::network::client $peerSock "node_id_handshake" query -query $node_id_nonce } } } # Stats ::nano::node::stats::incr [list keepalive] ::nano::node::stats::incr [list keepalive peers] [llength $peers] foreach peer $peers { ::nano::node::stats::lappend [list keepalive peersUnique] $peer } return "" } |
︙ | ︙ | |||
3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 | return [array get result] } proc ::nano::network::server::node_id_handshake {messageDict} { set retval "" if {"query" in [dict get $messageDict flags]} { set query [dict get $messageDict query] set clientID [dict get $::nano::node::configuration node client_id_private_key] set retval [dict create "invoke_client" [list node_id_handshake response -privateKey $clientID -query [binary decode hex $query]]] # Stats | > > | | > | | | | | 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 | return [array get result] } proc ::nano::network::server::node_id_handshake {messageDict} { set retval "" ::nano::node::stats::incr [list node_id_handshake] if {"query" in [dict get $messageDict flags]} { set query [dict get $messageDict query] set clientID [dict get $::nano::node::configuration node client_id_private_key] set retval [dict create "invoke_client" [list node_id_handshake response -privateKey $clientID -query [binary decode hex $query]]] # Stats ::nano::node::stats::incr [list node_id_handshake query] } if {"response" in [dict get $messageDict flags]} { set peerInfo [dict get $messageDict socket remote] set peerAddress [lindex $peerInfo 0] set peerPort [lindex $peerInfo 1] set peer [dict create address $peerAddress port $peerPort] # XXX:TODO: Verify the nonce if {![info exists ::nano::node::_node_id_nonces($peer)]} { return "" } set sentNonce $::nano::node::_node_id_nonces($peer) unset ::nano::node::_node_id_nonces($peer) # Add the peer to our list of peers #puts "Got node_id_handshake response from $peer" set ::nano::node::peers($peer) [dict create lastSeen [clock seconds]] # Stats ::nano::node::stats::incr [list node_id_handshake response] ::nano::node::stats::lappend [list node_id_handshake response uniqueKeys] [dict get $messageDict key] } return $retval } proc ::nano::network::server::confirm_req {messageDict} { ::nano::node::stats::incr [list confirm_req] return "" } proc ::nano::network::server::confirm_ack {messageDict} { # keep statistics dict with messageDict {} ::nano::node::stats::incr [list confirm_ack] ::nano::node::stats::incr [list confirm_ack valid $valid] if {!$valid} { return "" } ::nano::node::stats::incr [list confirm_ack rep $voteAccount valid $valid] ::nano::node::stats::incr [list confirm_ack voteType $voteType] ::nano::node::stats::incr [list confirm_ack rep $voteAccount voteType $voteType] ::nano::node::stats::newMinMax [list confirm_ack rep $voteAccount voteSequence] $voteSequence set votedOn [llength $hashes] ::nano::node::stats::incr [list confirm_ack votedOn] $votedOn ::nano::node::stats::incr [list confirm_ack rep $voteAccount votedOn] $votedOn foreach hash $hashes { ::nano::node::stats::lappend [list confirm_ack votedOnUnique] $hash ::nano::node::stats::lappend [list confirm_ack rep $voteAccount votedOnUnique] $hash } return "" } proc ::nano::protocol::parse::publish {extensions messageData} { set blockTypeID [expr {($extensions >> 8) & 0x0f}] |
︙ | ︙ | |||
3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 | } "open" - "state" { set valid false } } catch { set valid [::nano::internal::boolean [::nano::block::dict::verifySignature $block]] } set validWork [::nano::internal::boolean [::nano::block::dict::validateWork $block]] | > > > | | | 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 | } "open" - "state" { set valid false } } catch { set valid [::nano::internal::boolean [::nano::block::dict::verifySignature $block]] } if {$valid eq false && [dict get $block type] eq "state"} { # Check if possibly epoch } set validWork [::nano::internal::boolean [::nano::block::dict::validateWork $block]] ::nano::node::stats::incr [list publish] ::nano::node::stats::incr [list publish valid $valid] ::nano::node::stats::incr [list publish validWork $validWork] ::nano::node::stats::incr [list publish type [dict get $block type]] ::nano::node::stats::lappend [list publish unique] $hash }]} { puts "ERROR: $::errorInfo" } return "" } # Namespace ::nano::protocol::parse deals with the network level protocol (outside the node) # Namespace ::nano::network::server deals with the node's actual interaction with the network proc ::nano::protocol::parse {message} { |
︙ | ︙ | |||
3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 | set configuredNetwork [dict get $::nano::node::configuration network] if {$network ne $configuredNetwork} { return "" } dict set messageDict socket $peerSock set retval [dict create] if {[catch { set retval [::nano::network::server::${messageType} $messageDict] } err]} { if {![string match "invalid command name *" $err]} { ::nano::node::log "Error handling ${messageType}: $err" } | > > > > | 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 | set configuredNetwork [dict get $::nano::node::configuration network] if {$network ne $configuredNetwork} { return "" } dict set messageDict socket $peerSock # Stats ::nano::node::stats::incr [list datagram version $versionUsing] ::nano::node::stats::incr [list datagram network $network] set retval [dict create] if {[catch { set retval [::nano::network::server::${messageType} $messageDict] } err]} { if {![string match "invalid command name *" $err]} { ::nano::node::log "Error handling ${messageType}: $err" } |
︙ | ︙ | |||
3731 3732 3733 3734 3735 3736 3737 | set db ::nano::node::stats::_db if {[llength [info command $db]] != 0} { return } package require sqlite3 | > > > | > > > > > > > > > > > | 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 | set db ::nano::node::stats::_db if {[llength [info command $db]] != 0} { return } package require sqlite3 ::close [file tempfile dbFileName] file delete $dbFileName sqlite3 $db $dbFileName -create true $db eval {PRAGMA journal_mode = OFF} file delete $dbFileName tailcall clear } proc ::nano::node::stats::close {} { set db ::nano::node::stats::_db $db close } proc ::nano::node::stats::clear {} { set db ::nano::node::stats::_db $db eval {DROP TABLE IF EXISTS counters} $db eval {DROP TABLE IF EXISTS minmax} $db eval {DROP TABLE IF EXISTS lists} |
︙ | ︙ |