1
0
mirror of https://github.com/therootcompany/telebit.git synced 2025-04-17 21:30:43 +00:00

fixed bug with peeking I introduced during the cleanup

This commit is contained in:
tigerbot 2017-03-23 17:57:43 -06:00
parent c7b6a4a000
commit 0a7ef4c601
2 changed files with 10 additions and 8 deletions
main.go
rvpn/genericlistener

12
main.go

@ -35,10 +35,6 @@ var (
serverName string
)
func init() {
}
//Main -- main entry point
func main() {
flag.Parse()
@ -56,10 +52,10 @@ func main() {
wssHostName = viper.Get("rvpn.wssdomain").(string)
adminHostName = viper.Get("rvpn.admindomain").(string)
argGenericBinding = viper.GetInt("rvpn.genericlistener")
deadtime := viper.Get("rvpn.deadtime")
idle = deadtime.(map[string]interface{})["idle"].(int)
dwell = deadtime.(map[string]interface{})["dwell"].(int)
cancelcheck = deadtime.(map[string]interface{})["cancelcheck"].(int)
deadtime := viper.Get("rvpn.deadtime").(map[string]interface{})
idle = deadtime["idle"].(int)
dwell = deadtime["dwell"].(int)
cancelcheck = deadtime["cancelcheck"].(int)
lbDefaultMethod = viper.Get("rvpn.loadbalancing.defaultmethod").(string)
serverName = viper.Get("rvpn.serverName").(string)

@ -56,5 +56,11 @@ func (w *WedgeConn) Buffered() int {
// - get all the chars available
// - pass then back
func (w *WedgeConn) PeekAll() ([]byte, error) {
// We first peek with 1 so that if there is no buffered data the reader will
// fill the buffer before we read how much data is buffered.
if _, err := w.Peek(1); err != nil {
return nil, err
}
return w.Peek(w.Buffered())
}