Tao 1.7.0 TODOs:
. HashedWheelTImer
. 使用反射改進Handler設計
. read about teleport
. Tao - Go語言實現的TCP網絡編程框架 英文翻譯
. BufferSizeOption改為ChannelSizeOption
. 定時器重構
TimedTask要帶上net id作為context,把這個接口封裝好
Annoucing Tao 1.6.0
- Bugfix: writeLoop() drains all pending messages before exit;
writeLoop()函數退出前將所有的網絡數據包發送完畢; - Renaming getter methods according to Effective Go;
根據Effective Go重命名getter方法; - Bugfix: timer task expired forever due to system clock affected by NTP;
修復因為受NTP協議校正系統時鐘偏差的影響,導致定時任務永遠過期的bug; - Bugfix: asyncWrite() do not return error if called after ServerConn or ClientConn closes;
修復網絡連接關閉后調用asyncWrite()不返回錯誤的bug; - Providing WorkerSizeOption() for tuning the size of worker go-routine pool;
提供WorkerSizeOption()來調節工作者線程池大小; - Providing BufferSizeOption() for tuning the size of buffered channel;
提供BufferSizeOption()來調節緩沖通道大??; - Providing ReconnectOption() for activating ClientConn's reconnecting mechanism;
提供ReconnectOption()來啟動ClientConn的斷線重連機制; - Providing CustomCodecOption() for setting self-defined codec;
提供CustomCodecOption() 來設置自定義編解碼器; - Providing TLSCredsOption() for running a TLS server;
提供TLSCredsOption()來運行TLS服務器; - Providing OnConnectOption(), OnMessageOption(), OnCloseOption() and OnErrorOption() for setting callbacks of the four situations respectively;
提供OnConnectOption(), OnMessageOption(), OnCloseOption() 和 OnErrorOption()來設置四種情況下的回調函數; - Use the standard sync.Map instead of map guarded by rwmutex;
使用標準庫中的sync.Map替換使用rwmutex保護的map;
Anncoucing Tao 1.5.0
- A Golang-style redesigning of the overall framework, a reduce about 500+ lines of codes;
按照Go語言風格重新設計的整體框架,精簡500多行代碼; - Providing new Server, ClientConn and ServerConn struct and a WriteCloser interface;
提供Server,ClientConn和ServerConn三種新結構和WriteCloser新接口; - Using standard context package to manage and spread request-scoped data acrossing go-routines;
使用標準庫中的context包在多個Go線程中管理和傳播與請求有關的數據; - Graceful stopping, all go-routines are related by context, and they will be noticed and exit when server stops or connection closes;
優雅停機,所有的Go線程都通過上下文進行關聯,當服務器停機或連接關閉時它們都會收到通知并執行退出; - Providing new type HandlerFunc func(context.Context, WriteCloser) for defining message handlers;
提供新的HandlerFunc類型來定義消息處理器; - Developers can now use NewContextWithMessage() and MessageFromContext() to put and get message they are about to use in handler function's context, this also leads to a more clarified design;
開發者現在可以通過NewContextWithMessage()和MessageFromContext()函數來在上下文中存取他們將在處理器函數中使用的消息,這樣的設計更簡潔; - Go-routine functions readLoop(), writeLoop() and handleLoop() are all optimized to serve both ServerConn and ClientConn, serveral dead-lock bugs such as blocking on channels are fixed;
優化Go線程函數readLoop(),writeLoop()和handleLoop()使得它們能同時為ServerConn和ClientConn服務,修復了多個“通道阻塞”的死鎖問題; - Reconnecting mechanism of ClientConn is redesigned and optimized;
重新設計和優化ClientConn的斷線重連機制;
Announcing Tao 1.4.0
- bugfix:TLS重連失敗問題;
bugfix: failed to reconnect the TLS connection; - bugfix:ConnectionMap死鎖問題;
bugfix: ConnectionMap dead-lock problem; - 優化TCP網絡連接的關閉過程;
Optimize the closing process of TCP connection; - 優化服務器的關閉過程;
Optimize the closing process of server; - 更優雅的消息處理注冊接口;
More elegant message handler register interface;
Announcing Tao 1.3.0
- bugfix:修復斷線重連狀態不一致問題;
bugfix: fixed inconsistent status caused by reconnecting; - bugfix:修復ServerConnection和TimingWheel在連接關閉時并發訪問導致崩潰問題;
bugfix: fixed a corruption caused by concurrent accessing between ServerConnection and TimingWheel during connection closing; - 無鎖且線程安全的TimingWheel,優化CPU占用率;
Lock-free and thread-safe TimingWheel, optimized occupancy rate; - bugfix:修復TLS配置文件讀取函數;
bugfix: Fixed errors when loading TLS config; - 添加消息相關的Context結構;簡化消息注冊機制,直接注冊處理函數到HandlerMap;
A message-related Context struct added; Register handler functions in HandlerMap directly to simplify message registration mechanism; - 合并NewClientConnection()和NewTLSClientConnection(),提供一致的API;
Combine NewTLSConnection() into NewClientConnection(), providing a consistent API; - 工作者線程池改造成單例模式;
Make WorkerPool a singleton pattern; - 使用Holmes日志庫代替glog;
Using Holmes logging package instead of glog; - 添加metrics.go:基于expvar標準包導出服務器關鍵信息;
Add metrics.go: exporting critical server information based on expvar standard pacakge;
Announcing Tao 1.2.0
- 更優雅的消息注冊接口;
More elegant message register interface; - TCPConnection的斷線重連機制;
TCPConnection reconnecting upon closing; - bugfix:協議未注冊時不關閉客戶端連接;
bugfix: Don't close client when messages not registered; - bugfix:在readLoop()協程中處理心跳時間戳更新;
bugfix: Updating heart-beat timestamp in readLoop() go-routine; - bugfix:Message接口使用Serialize()替代之前的MarshalBinary(),以免框架使用者使用gob.Encoder/Decoder的時候棧溢出;
bugfix: Use Serialize() instead of MarshalBinary() in Message interface, preventing stack overflows when framework users use gob.Encoder/Decoder; - bugfix:當應用層數據長度大于0時才對其進行序列化;
bugfix: Serialize application data when its length greater than 0; - 新API:SetCodec(),允許TCPConnection自定義編解碼器;
New API: SetCodec() allowing TCPConnection defines its own codec; - 新API:SetDBInitializer(),允許框架使用者定義數據訪問接口;
New API: SetDBInitializer() allowing framework users define data access interface; - 允許框架使用者在TCPConnection上設置自定義數據;
Allowing framework users setting custom data on TCPConnection; - 為新客戶端連接的啟動單獨開辟一個對應的go協程;
Allocating a corresponding go-routine for newly-connected clients respectively; - bugfix:寫事件循環在連接關閉時將信道中的數據全部發送出去;
bugfix: writeLoop() flushes all packets left in channel when performing closing; - bugfix:服務器和客戶端連接等待所有go協程關閉后再退出;
bugfix: Servers and client connections wait for the exits of all go-routines before shutting down; - 重構Server和Connection,采用針對接口編程的設計;
Refactoring Server and Connection, adopting a programming-by-interface design; - 設置500毫秒讀超時,防止readLoop()發生阻塞;
Setting 500ms read-timeout prevents readLoop() from blocking;
Annoucing Tao 1.1.0
- 添加注釋,提高代碼可讀性
Add comments, make it more readable; - 服務器的最大并發連接數(默認1000)
Server max connections limit (default to 1000); - 新API:TCPServer:NewTLSTCPServer() 創建傳輸層安全的TCP服務器
New API: NewTLSTCPServer() for creating TLS-supported TCP server; - 新特性:TCPServer:SetOnScheduleCallback() 由框架使用者來定義計劃任務(比如心跳)
Make scheduled task managed by framwork users; - 新特性:支持默認的消息編解碼器TypeLengthValueCodec,并允許框架使用者開發自定義編解碼器
Support TypeLengthValueCodec by default, allow framework users develop their own codecs;