<commit_before>// Copyright 2015 Factom Foundation
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.

package main

import (
	"fmt"
	"log"
	"os"
	"runtime"
	
	"github.com/FactomProject/FactomCode/database"
	"github.com/FactomProject/FactomCode/process"	
	"github.com/FactomProject/FactomCode/database/ldb"
	"github.com/FactomProject/FactomCode/util"
	"github.com/FactomProject/FactomCode/wsapi"
	"github.com/FactomProject/btcd"
	"github.com/FactomProject/btcd/limits"
	"github.com/FactomProject/btcd/wire"
)

var (
	cfg             *util.FactomdConfig
	shutdownChannel = make(chan struct{})
	ldbpath         = "/tmp/ldb9"
	db              database.Db                           // database
	inMsgQueue      = make(chan wire.FtmInternalMsg, 100) //incoming message queue for factom application messages
	outMsgQueue     = make(chan wire.FtmInternalMsg, 100) //outgoing message queue for factom application messages
	inCtlMsgQueue   = make(chan wire.FtmInternalMsg, 100) //incoming message queue for factom application messages
	outCtlMsgQueue  = make(chan wire.FtmInternalMsg, 100) //outgoing message queue for factom application messages
	//	inRpcQueue      = make(chan wire.Message, 100) //incoming message queue for factom application messages
)

// winServiceMain is only invoked on Windows.  It detects when btcd is running
// as a service and reacts accordingly.
//var winServiceMain func() (bool, error)

func main() {
	fmt.Println("//////////////////////// Copyright 2015 Factom Foundation")
	fmt.Println("//////////////////////// Use of this source code is governed by the MIT")
	fmt.Println("//////////////////////// license that can be found in the LICENSE file.")

	util.Trace()

	// Load configuration file and send settings to components
	loadConfigurations()

	// Initialize db
	initDB()

	util.Trace()
	// Use all processor cores.
	runtime.GOMAXPROCS(runtime.NumCPU())

	//Up some limits.
	if err := limits.SetLimits(); err != nil {
		os.Exit(1)
	}

	// Call serviceMain on Windows to handle running as a service.  When
	// the return isService flag is true, exit now since we ran as a
	// service.  Otherwise, just fall through to normal operation.
	/*
		if runtime.GOOS == "windows" {
			isService, err := winServiceMain()
			if err != nil {
				fmt.Println(err)
				os.Exit(1)
			}
			if isService {
				os.Exit(0)
			}
		}
	*/
	// Work around defer not working after os.Exit()
	if err := factomdMain(); err != nil {
		os.Exit(1)
	}

}

func factomdMain() error {

	// Start the processor module
	go process.Start_Processor(db, inMsgQueue, outMsgQueue, inCtlMsgQueue, outCtlMsgQueue)

	// Start the wsapi server module in a separate go-routine
	wsapi.Start(db, inMsgQueue)

	// Start the factoid (btcd) component and P2P component
	btcd.Start_btcd(db, inMsgQueue, outMsgQueue, inCtlMsgQueue, outCtlMsgQueue)
<commit_msg>Added user and pass for btcd<commit_after>// Copyright 2015 Factom Foundation
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.

package main

import (
	"fmt"
	"log"
	"os"
	"runtime"
	
	"github.com/FactomProject/FactomCode/database"
	"github.com/FactomProject/FactomCode/process"	
	"github.com/FactomProject/FactomCode/database/ldb"
	"github.com/FactomProject/FactomCode/util"
	"github.com/FactomProject/FactomCode/wsapi"
	"github.com/FactomProject/btcd"
	"github.com/FactomProject/btcd/limits"
	"github.com/FactomProject/btcd/wire"
)

var (
	cfg             *util.FactomdConfig
	shutdownChannel = make(chan struct{})
	ldbpath         = "/tmp/ldb9"
	db              database.Db                           // database
	inMsgQueue      = make(chan wire.FtmInternalMsg, 100) //incoming message queue for factom application messages
	outMsgQueue     = make(chan wire.FtmInternalMsg, 100) //outgoing message queue for factom application messages
	inCtlMsgQueue   = make(chan wire.FtmInternalMsg, 100) //incoming message queue for factom application messages
	outCtlMsgQueue  = make(chan wire.FtmInternalMsg, 100) //outgoing message queue for factom application messages
	//	inRpcQueue      = make(chan wire.Message, 100) //incoming message queue for factom application messages
)

// winServiceMain is only invoked on Windows.  It detects when btcd is running
// as a service and reacts accordingly.
//var winServiceMain func() (bool, error)

func main() {
	fmt.Println("//////////////////////// Copyright 2015 Factom Foundation")
	fmt.Println("//////////////////////// Use of this source code is governed by the MIT")
	fmt.Println("//////////////////////// license that can be found in the LICENSE file.")

	util.Trace()

	// Load configuration file and send settings to components
	loadConfigurations()

	// Initialize db
	initDB()

	util.Trace()
	// Use all processor cores.
	runtime.GOMAXPROCS(runtime.NumCPU())

	//Up some limits.
	if err := limits.SetLimits(); err != nil {
		os.Exit(1)
	}

	// Call serviceMain on Windows to handle running as a service.  When
	// the return isService flag is true, exit now since we ran as a
	// service.  Otherwise, just fall through to normal operation.
	/*
		if runtime.GOOS == "windows" {
			isService, err := winServiceMain()
			if err != nil {
				fmt.Println(err)
				os.Exit(1)
			}
			if isService {
				os.Exit(0)
			}
		}
	*/
	// Work around defer not working after os.Exit()
	if err := factomdMain(); err != nil {
		os.Exit(1)
	}

}

func factomdMain() error {

	// Start the processor module
	go process.Start_Processor(db, inMsgQueue, outMsgQueue, inCtlMsgQueue, outCtlMsgQueue)

	// Start the wsapi server module in a separate go-routine
	wsapi.Start(db, inMsgQueue)

	// Start the factoid (btcd) component and P2P component
	btcd.Start_btcd(db, inMsgQueue, outMsgQueue, inCtlMsgQueue, outCtlMsgQueue, process.FactomdUser, process.FactomdPass)

{'fraction_non_alphanumeric': 0.12244897959183673, 'fraction_numerical': 0.009946835877208026, 'mean_word_length': 3.1244695898161243, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4779458', 'n_tokens_mistral': 1929, 'n_tokens_neox': 1802, 'n_words': 567}