Update encode API
tcp_session: cleanup