You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
491 B
30 lines
491 B
2 years ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
"net"
|
||
|
)
|
||
|
|
||
|
// TODO: multiple services...
|
||
|
|
||
|
func TryLogin(task *Task, conn net.Conn) (res bool, err error) {
|
||
|
defer func() {
|
||
|
if r := recover(); r != nil {
|
||
|
log("srv", 1, "fatal error (panic) in service handler: %v", r)
|
||
|
res = false
|
||
|
|
||
|
switch x := r.(type) {
|
||
|
case string:
|
||
|
err = errors.New(x)
|
||
|
case error:
|
||
|
err = x
|
||
|
default:
|
||
|
err = errors.New("unknown error")
|
||
|
}
|
||
|
}
|
||
|
}()
|
||
|
|
||
|
res, err = NewWinbox(task, conn).TryLogin()
|
||
|
return res, err
|
||
|
}
|