You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
606 B
Go
38 lines
606 B
Go
2 years ago
|
package net
|
||
|
|
||
|
import (
|
||
|
"git.noahlan.cn/northlan/nnet/interfaces"
|
||
|
"net"
|
||
|
)
|
||
|
|
||
|
type Request struct {
|
||
|
session interfaces.ISession // Session
|
||
|
|
||
|
server *Server // Server reference
|
||
|
conn net.Conn // low-level conn fd
|
||
|
status Status // 连接状态
|
||
|
}
|
||
|
|
||
|
func newRequest(server *Server, conn net.Conn) *Request {
|
||
|
r := &Request{
|
||
|
server: server,
|
||
|
conn: conn,
|
||
|
status: StatusStart,
|
||
|
}
|
||
|
|
||
|
r.session = newSession()
|
||
|
return r
|
||
|
}
|
||
|
|
||
|
func (r *Request) Status() Status {
|
||
|
return r.status
|
||
|
}
|
||
|
|
||
|
func (r *Request) ID() int64 {
|
||
|
return r.session.ID()
|
||
|
}
|
||
|
|
||
|
func (r *Request) Session() interfaces.ISession {
|
||
|
return r.session
|
||
|
}
|