mirror of
https://github.com/amigan/aim-oscar-server.git
synced 2025-01-31 04:52:37 -05:00
dump flap on errors
This commit is contained in:
parent
2b06886058
commit
0d201678de
3 changed files with 7 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,3 +4,4 @@ dist
|
|||
aim-oscar
|
||||
aim.db
|
||||
vendor
|
||||
.DS_Store
|
||||
|
|
4
main.go
4
main.go
|
@ -170,7 +170,9 @@ func main() {
|
|||
handleFn := func(ctx context.Context, flap *oscar.FLAP) context.Context {
|
||||
session, err := oscar.SessionFromContext(ctx)
|
||||
if err != nil {
|
||||
util.PanicIfError(err)
|
||||
// TODO
|
||||
log.Printf("no session in context. FLAP dump:\n%s\n", flap)
|
||||
return ctx
|
||||
}
|
||||
|
||||
if user := models.UserFromContext(ctx); user != nil {
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"aim-oscar/util"
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net"
|
||||
|
@ -37,8 +38,7 @@ func (h *Handler) Handle(conn net.Conn) {
|
|||
// send a hello
|
||||
hello := NewFLAP(1)
|
||||
hello.Data.Write([]byte{0, 0, 0, 1})
|
||||
err := session.Send(hello)
|
||||
util.PanicIfError(err)
|
||||
session.Send(hello)
|
||||
session.GreetedClient = true
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,7 @@ func (h *Handler) Handle(conn net.Conn) {
|
|||
flapLength := int(dataLength) + 6
|
||||
if len(buf) < flapLength {
|
||||
log.Printf("not enough data, only %d bytes\n", len(buf))
|
||||
fmt.Printf("%s\n", util.PrettyBytes(buf))
|
||||
break
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue