mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	Add support for building "release" builds that don't contain pprof which are substantially smaller. To build a "debug" build, use "-tags debug" with "go build"
This commit is contained in:
		
							parent
							
								
									e9b1006dda
								
							
						
					
					
						commit
						a9e61d0d37
					
				
					 3 changed files with 31 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -11,11 +11,7 @@ import "syscall"
 | 
			
		|||
import "time"
 | 
			
		||||
import "regexp"
 | 
			
		||||
import "math/rand"
 | 
			
		||||
 | 
			
		||||
import _ "net/http/pprof"
 | 
			
		||||
import "net/http"
 | 
			
		||||
import "log"
 | 
			
		||||
import "runtime"
 | 
			
		||||
 | 
			
		||||
import "yggdrasil"
 | 
			
		||||
import "yggdrasil/config"
 | 
			
		||||
| 
						 | 
				
			
			@ -191,8 +187,9 @@ func main() {
 | 
			
		|||
	logger := log.New(os.Stdout, "", log.Flags())
 | 
			
		||||
	// If the -pprof flag was provided then start the pprof service on port 6060.
 | 
			
		||||
	if *pprof {
 | 
			
		||||
		runtime.SetBlockProfileRate(1)
 | 
			
		||||
		go func() { log.Println(http.ListenAndServe("localhost:6060", nil)) }()
 | 
			
		||||
		if err := yggdrasil.StartProfiler(logger); err != nil {
 | 
			
		||||
			logger.Println(err)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	// Setup the Yggdrasil node itself. The node{} type includes a Core, so we
 | 
			
		||||
	// don't need to create this manually.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue