예제 #1
0
파일: alarm.go 프로젝트: zzragida/goquic
func (alarm *GoQuicAlarm) OnAlarm() {
	if now := int64(C.clock_now(alarm.clock)); now < alarm.deadline {
		// This should be very rarely occrued. Otherwise this could be performance bottleneck.
		fmt.Println(now, time.Now().UnixNano()/1000000, alarm.wrapper, alarm.deadline, "Warning: Timer not adjustted")
		alarm.SetImpl()
		return
	}

	// There can be race condition between QuicAlarm destruction and OnAlarm callback. So this check is needed
	if alarm.isCanceled {
		return
	}

	C.go_quic_alarm_fire(alarm.wrapper)
}
예제 #2
0
파일: alarm.go 프로젝트: zzragida/goquic
func (alarm *GoQuicAlarm) Now() int64 {
	return int64(C.clock_now(alarm.clock))
}