Documentation ¶
Index ¶
- Constants
- Variables
- func Dial(addr string) (net.Conn, error)
- func Listen(addr string) (*headquarters, error)
- func NewHeadquarters() *headquarters
- type Sniper
- func (s *Sniper) CleanStatistics()
- func (s *Sniper) Close() error
- func (s *Sniper) Debug()
- func (s *Sniper) LocalAddr() net.Addr
- func (s *Sniper) OpenFec(dataShards, parShards int)
- func (s *Sniper) OpenStaTraffic()
- func (s *Sniper) Read(b []byte) (n int, err error)
- func (s *Sniper) RemoteAddr() net.Addr
- func (s *Sniper) SetDeadline(t time.Time) error
- func (s *Sniper) SetInterval(interval int64)
- func (s *Sniper) SetPackageSize(size int64)
- func (s *Sniper) SetReadDeadline(t time.Time) error
- func (s *Sniper) SetRecWin(size int64)
- func (s *Sniper) SetSendWin(size int32)
- func (s *Sniper) SetWriteDeadline(t time.Time) error
- func (s *Sniper) TrafficStatistics() Statistics
- func (s *Sniper) Write(b []byte) (n int, err error)
- type Statistics
- type TimedSched
Constants ¶
View Source
const ( DEFAULT_HEAD_SIZE = 20 DEFAULT_INIT_SENDWIND = 64 DEFAULT_INIT_RECEWIND = 1 << 10 DEFAULT_INIT_PACKSIZE = 1000 DEFAULT_INIT_HEALTHTICKER = 1 DEFAULT_INIT_HEALTHCHECK_TIMEOUT_TRY_COUNT = 10 DEFAULT_INIT_HANDSHACK_TIMEOUT = 6 DEFAULT_INIT_RTO_UNIT = float64(200 * time.Millisecond) DEFAULT_INIT_DELAY_ACK = float64(200 * time.Millisecond) DEFAULT_INIT_INTERVAL = 500 )
View Source
const ( STATUS_NONE = iota STATUS_SECONDHANDSHACK STATUS_THIRDHANDSHACK STATUS_NORMAL STATUS_CLOSEING1 STATUS_CLOSEING2 STATUS_CLOSEING3 )
Variables ¶
View Source
var ( CLOSEERROR = errors.New("the connection is closed") HEALTHTIMEOUTERROR = errors.New("health monitor timeout ") TIMEOUERROR = timeout(0) RCVAMMOBAGEMPTY = make([]*protocol.Ammo, DEFAULT_INIT_RECEWIND) )
Functions ¶
func NewHeadquarters ¶
func NewHeadquarters() *headquarters
Types ¶
type Sniper ¶
type Sniper struct { Statistics // contains filtered or unexported fields }
func (*Sniper) CleanStatistics ¶ added in v0.1.6
func (s *Sniper) CleanStatistics()
func (*Sniper) OpenFec ¶
OpenFec use FEC algorithm in communication this will waste some of traffic , but when the packet is lost there is a certain probability that the lost packet can be recovered
func (*Sniper) OpenStaTraffic ¶ added in v0.1.6
func (s *Sniper) OpenStaTraffic()
func (*Sniper) RemoteAddr ¶
func (*Sniper) SetInterval ¶
func (*Sniper) SetPackageSize ¶ added in v0.1.6
func (*Sniper) SetSendWin ¶
func (*Sniper) TrafficStatistics ¶ added in v0.1.6
func (s *Sniper) TrafficStatistics() Statistics
type Statistics ¶ added in v0.1.6
type TimedSched ¶ added in v0.1.2
type TimedSched struct {
// contains filtered or unexported fields
}
TimedSched represents the control struct for timed parallel scheduler
var SystemTimedSched *TimedSched = NewTimedSched(runtime.NumCPU())
SystemTimedSched is the library level timed-scheduler
func NewTimedSched ¶ added in v0.1.2
func NewTimedSched(parallel int) *TimedSched
NewTimedSched creates a parallel-scheduler with given parallelization
func (*TimedSched) Close ¶ added in v0.1.2
func (ts *TimedSched) Close()
Close terminates this scheduler
func (*TimedSched) Put ¶ added in v0.1.2
func (ts *TimedSched) Put(f func(), deadline time.Time)
Put a function 'f' awaiting to be executed at 'deadline'
Source Files ¶
Click to show internal directories.
Click to hide internal directories.