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.
29 lines
491 B
29 lines
491 B
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
|
|
}
|
|
|