libnmdc/libnmdc.go

29 lines
804 B
Go
Raw Normal View History

2016-02-12 04:03:42 +00:00
package libnmdc
import (
"errors"
"strconv"
2016-02-12 04:03:42 +00:00
"time"
)
2016-04-03 06:53:14 +00:00
const (
DEFAULT_CLIENT_TAG string = "libnmdc.go"
2018-03-24 03:52:46 +00:00
DEFAULT_CLIENT_VERSION string = "0.18"
DEFAULT_HUB_NAME string = "(unknown)"
SEND_KEEPALIVE_EVERY time.Duration = 29 * time.Second
AUTO_RECONNECT_AFTER time.Duration = 30 * time.Second
RECONNECT_IF_NO_DATA_RECIEVED_IN time.Duration = 24 * time.Hour // we expect keepalives wayyyy more frequently than this
AUTODETECT_ADC_NMDC_TIMEOUT time.Duration = 3 * time.Second
2016-04-03 06:53:14 +00:00
)
var ErrNotConnected error = errors.New("Not connected")
2016-02-12 04:03:42 +00:00
func maybeParse(str string, dest *uint64, default_val uint64) {
sz, err := strconv.ParseUint(str, 10, 64)
if err == nil {
*dest = sz
} else {
*dest = default_val
2016-02-12 04:03:42 +00:00
}
}