This commit is contained in:
crusader 2017-11-27 20:35:39 +09:00
parent dfd14c7fd7
commit 4eaa31788d
4 changed files with 5 additions and 5 deletions

View File

@ -23,7 +23,7 @@ func New(sh ServerHandler) Server {
s := &server{
sh: sh,
}
s.ctx = newServerContext()
s.ctx = NewServerContext(nil)
return s
}

View File

@ -12,9 +12,9 @@ type serverContext struct {
cuc.Context
}
func newServerContext() ServerContext {
func NewServerContext(parent cuc.Context) ServerContext {
sCTX := &serverContext{}
sCTX.Context = cuc.NewContext(nil)
sCTX.Context = cuc.NewContext(parent)
return sCTX
}

View File

@ -156,7 +156,7 @@ func newSocket(serverCTX ServerContext, id string, conn *websocket.Conn, sh Sock
if 0 < sh.GetReadTimeout() {
s.SetReadDeadline(time.Now().Add(sh.GetReadTimeout() * time.Second))
}
s.ctx = newSocketContext(serverCTX)
s.ctx = NewSocketContext(serverCTX)
return s
}

View File

@ -9,7 +9,7 @@ type SocketContext interface {
ServerContext() ServerContext
}
func newSocketContext(serverCTX ServerContext) SocketContext {
func NewSocketContext(serverCTX ServerContext) SocketContext {
sCTX := &socketContext{}
sCTX.Context = cuc.NewContext(serverCTX)
sCTX.serverCTX = serverCTX