aceld / zinx

A lightweight concurrent server framework based on Golang.
https://github.com/aceld/zinx/wiki
MIT License
7.05k stars 1.21k forks source link

decoder、pack、framedecoder #316

Open Deng-Xiaodong opened 5 months ago

Deng-Xiaodong commented 5 months ago

编解码这部分感觉好乱。。。 首先connection已经默认使用framedecoder,然后在读客户端数据时已经成功解码得到imessage并且包装成irequest交给chainbuilder去处理。但是body的第一个inception是一个解码器,拿着rawdata又解码一次,得到imessage,然后调用ProceedWithIMessage去处理了一下下才真正进入router处理逻辑。为什么不在第一次由connection解码成功后的request直接进入chain处理router逻辑呢?中间的解码拦截器有什么作用?

Deng-Xiaodong commented 5 months ago

哦,decoder inception 好像是为了支持自定义解码器。如果用户不setdecoder,那么就使用connection上默认的framedecoder