Skip to content

Instantly share code, notes, and snippets.

@jackey
Last active August 4, 2019 03:37
Show Gist options
  • Save jackey/2c96a0f148228ff59aa5aa42768af71c to your computer and use it in GitHub Desktop.
Save jackey/2c96a0f148228ff59aa5aa42768af71c to your computer and use it in GitHub Desktop.
read socket message
/**
goroutine 32842 [IO wait]:
internal/poll.runtime_pollWait(0x7f41c5807930, 0x72, 0xc0005c7b98)
/usr/local/go/src/runtime/netpoll.go:173 +0x66
internal/poll.(*pollDesc).wait(0xc000d09298, 0x72, 0xffffffffffffff00, 0x75a040, 0x9084e8)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0x9a
internal/poll.(*pollDesc).waitRead(0xc000d09298, 0xc00177b000, 0x1000, 0x1000)
/usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Read(0xc000d09280, 0xc00177b000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:169 +0x179
net.(*netFD).Read(0xc000d09280, 0xc00177b000, 0x1000, 0x1000, 0xc001e77090, 0xc000e6fc00, 0x0)
/usr/local/go/src/net/fd_unix.go:202 +0x4f
net.(*conn).Read(0xc00000e2d0, 0xc00177b000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:177 +0x68
bufio.(*Reader).fill(0xc0007cb740)
/usr/local/go/src/bufio/bufio.go:100 +0x10f
bufio.(*Reader).Peek(0xc0007cb740, 0x2, 0x0, 0x20, 0x4, 0xd14257a1, 0x0)
/usr/local/go/src/bufio/bufio.go:132 +0x3f
github.com/gorilla/websocket.(*Conn).read(0xc001e77080, 0x2, 0x0, 0x0, 0xc000b6c624, 0x4, 0x0)
/var/www/html/golang/src/github.com/gorilla/websocket/conn.go:357 +0x40
github.com/gorilla/websocket.(*Conn).advanceFrame(0xc001e77080, 0x9, 0x0, 0x0)
/var/www/html/golang/src/github.com/gorilla/websocket/conn.go:785 +0x5c
github.com/gorilla/websocket.(*Conn).NextReader(0xc001e77080, 0xc001c16378, 0xc000418000, 0xb6, 0x600, 0x0)
/var/www/html/golang/src/github.com/gorilla/websocket/conn.go:945 +0xa0
github.com/gorilla/websocket.(*Conn).ReadMessage(0xc001e77080, 0xc000418000, 0xb6, 0x600, 0x600, 0x0, 0x0)
/var/www/html/golang/src/github.com/gorilla/websocket/conn.go:1026 +0x2f
imessage.(*User).ReadPump(0xc001a4a8c0)
/var/www/html/golang/src/imessage/user.go:76 +0x56
created by imessage.(*User).Start
/var/www/html/golang/src/imessage/user.go:46 +0x61
/**
func (user *User) ReadPump() {
for {
_, msg, err := user.Connection.Socket.ReadMessage()
if err != nil {
fmt.Println("read user message wrong", err)
break
} else {
HandleUserData(user, msg)
}
}
log.Println("user quit read pump")
user.Quit <- true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment