created "Node"

This commit is contained in:
Jae Kwon
2014-07-09 18:33:44 -07:00
parent 237b3dc7ff
commit 1b59caf950
8 changed files with 121 additions and 18 deletions
+5 -1
View File
@@ -2,7 +2,10 @@ package common
import "time"
/* RepeatTimer */
/*
RepeatTimer repeatedly sends a struct{}{} to .Ch after each "dur" period.
It's good for keeping connections alive.
*/
type RepeatTimer struct {
Ch chan struct{}
quit chan struct{}
@@ -26,6 +29,7 @@ func (t *RepeatTimer) fireHandler() {
}
}
// Wait the duration again before firing.
func (t *RepeatTimer) Reset() {
t.timer.Reset(t.dur)
}