<commit_before>###

dnschain
http://dnschain.net

Copyright (c) 2014 okTurtles Foundation

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.

###

module.exports = (dnschain) ->
    # expose these into our namespace
    for k of dnschain.globals
        eval "var #{k} = dnschain.globals.#{k};"

    class BDNSPeer
        constructor: (@dnschain) ->
            # @log = @dnschain.log.child server: "BDNS"
            @log = gNewLogger 'BDNS'
            @log.debug "Loading BDNSPeer..."
            
            get = gConf.bdns.get
            [host, port] = get('rpc:httpd_endpoint')?.split ':'
            if host?
                port = parseInt port
                @peer = rpc.Client.$create port, host, get('rpc:rpc_user'), get('rpc:rpc_password')
                gErr "rpc $create bdns" unless @peer
                @log.info "rpc to bitshares_client on: %s:%d/rpc", host, port
            else<commit_msg>Fixed BDNS-related crash (when no configuration defined).<commit_after>###

dnschain
http://dnschain.net

Copyright (c) 2014 okTurtles Foundation

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.

###

module.exports = (dnschain) ->
    # expose these into our namespace
    for k of dnschain.globals
        eval "var #{k} = dnschain.globals.#{k};"

    class BDNSPeer
        constructor: (@dnschain) ->
            # @log = @dnschain.log.child server: "BDNS"
            @log = gNewLogger 'BDNS'
            @log.debug "Loading BDNSPeer..."
            
            get = gConf.bdns.get
            endpoint = get('rpc:httpd_endpoint')?.split ':'
            if endpoint?
                [host, port] = [endpoint[0], parseInt endpoint[1]]
                @peer = rpc.Client.$create port, host, get('rpc:rpc_user'), get('rpc:rpc_password')
                gErr "rpc $create bdns" unless @peer
                @log.info "rpc to bitshares_client on: %s:%d/rpc", host, port
            else
{'fraction_non_alphanumeric': 0.1208941605839416, 'fraction_numerical': 0.008211678832116789, 'mean_word_length': 2.1508620689655173, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5858845', 'n_tokens_mistral': 707, 'n_tokens_neox': 675, 'n_words': 210}