优化Event增加接口支持

This commit is contained in:
boyce
2021-01-19 10:35:06 +08:00
parent 8155eb592e
commit 3c5c424996
4 changed files with 31 additions and 24 deletions

View File

@@ -286,8 +286,8 @@ func (slf *HttpRouter) Router(session *HttpSession){
session.Done()
}
func (httpService *HttpService) HttpEventHandler(ev *event.Event) {
ev.Data.(*HttpSession).Handle()
func (httpService *HttpService) HttpEventHandler(ev event.IEvent) {
ev.(*event.Event).Data.(*HttpSession).Handle()
}
func (httpService *HttpService) SetHttpRouter(httpRouter IHttpRouter,eventHandler event.IEventHandler) {

View File

@@ -135,8 +135,8 @@ func (tcpService *TcpService) OnInit() error{
return nil
}
func (tcpService *TcpService) TcpEventHandler(ev *event.Event) {
pack := ev.Data.(TcpPack)
func (tcpService *TcpService) TcpEventHandler(ev event.IEvent) {
pack := ev.(*event.Event).Data.(TcpPack)
switch pack.Type {
case TPT_Connected:
tcpService.process.ConnectedRoute(pack.ClientId)