Skip to content

Commit

Permalink
Upgrade the function of authentication space
Browse files Browse the repository at this point in the history
  • Loading branch information
AstaFrode committed Nov 13, 2022
1 parent a468d9f commit c66e4a7
Show file tree
Hide file tree
Showing 10 changed files with 159 additions and 405 deletions.
6 changes: 6 additions & 0 deletions cmd/main/main.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package main

import (
// "net/http"
// _ "net/http/pprof"

"github.com/CESSProject/cess-bucket/cmd"
)

// program entry
func main() {
// go func() {
// http.ListenAndServe(":8080", nil)
// }()
cmd.Execute()
}
25 changes: 24 additions & 1 deletion configs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package configs
import "time"

// type and version
const Version = "CESS-Bucket v0.5.3"
const Version = "CESS-Bucket v0.5.4_dev"

// return code
const (
Expand Down Expand Up @@ -35,6 +35,29 @@ const (
TimeToWaitEvents = time.Duration(time.Second * 15)
)

const (
// Maximum number of connections in the miner's certification space
MAX_TCP_CONNECTION uint8 = 3
// Tcp client connection interval
TCP_Connection_Interval = time.Duration(time.Millisecond * 100)
// Tcp message interval
TCP_Message_Interval = time.Duration(time.Millisecond * 10)
// Tcp short message waiting time
TCP_Time_WaitNotification = time.Duration(time.Second * 10)
// Tcp short message waiting time
TCP_FillerMessage_WaitingTime = time.Duration(time.Second * 150)
// The slowest tcp transfers bytes per second
TCP_Transmission_Slowest = SIZE_1KiB * 10
// Number of tcp message caches
TCP_Message_Send_Buffers = 10
TCP_Message_Read_Buffers = 10
//
TCP_SendBuffer = SIZE_1KiB * 8
TCP_ReadBuffer = SIZE_1KiB * 16
//
Tcp_Dial_Timeout = time.Duration(time.Second * 5)
)

const (
HELP_common = `Please check with the following help information:
1.Check if the wallet balance is sufficient
Expand Down
4 changes: 2 additions & 2 deletions initlz/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"runtime"
)

//system init
// system init
func SystemInit() {
if !runOnLinuxSystem() {
fmt.Printf("\x1b[%dm[err]\x1b[0m Please execute on Linux system\n", 41)
Expand All @@ -24,5 +24,5 @@ func runWithRootPrivileges() bool {
}

func setAllCores() {
runtime.GOMAXPROCS(runtime.NumCPU())
runtime.GOMAXPROCS(runtime.NumCPU() - 1)
}
3 changes: 2 additions & 1 deletion internal/node/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ type Server interface {

type Client interface {
SendFile(fid string, pkey, signmsg, sign []byte) error
RecvFiller(pkey, signmsg, sign []byte) error
//RecvFiller(pkey, signmsg, sign []byte) error
}

type NetConn interface {
HandlerLoop()
GetMsg() (*Message, bool)
SendMsg(m *Message)
GetRemoteAddr() string
Close() error
IsClose() bool
}
Expand Down
6 changes: 1 addition & 5 deletions internal/node/coroutineMgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ func (node *Node) CoroutineMgr() {
channel_1 = make(chan bool, 1)
channel_2 = make(chan bool, 1)
channel_3 = make(chan bool, 1)
channel_4 = make(chan bool, 1)
)
go node.task_self_judgment(channel_1)
go node.task_RemoveInvalidFiles(channel_2)
go node.task_HandlingChallenges(channel_3)
go node.task_SpaceManagement(channel_4)

for {
select {
case <-channel_1:
Expand All @@ -19,9 +18,6 @@ func (node *Node) CoroutineMgr() {
go node.task_RemoveInvalidFiles(channel_2)
case <-channel_3:
go node.task_HandlingChallenges(channel_3)
case <-channel_4:
go node.task_SpaceManagement(channel_4)
}

}
}
Loading

0 comments on commit c66e4a7

Please sign in to comment.