Skip to content
Permalink
Browse files
fix: oom
  • Loading branch information
zhaoleipeng committed Jun 17, 2021
1 parent f232785 commit 0a0472bc5f028491fe610df1ddffec36c06c83d1
Showing 2 changed files with 7 additions and 7 deletions.
@@ -1,6 +1,6 @@
{
"name": "@apache/dubbo-serialization",
"version": "0.0.1",
"version": "0.0.2",
"main": "./lib/index.js",
"types": "./lib/typings/index.d.ts",
"license": "Apache Licence 2.0",
@@ -47,13 +47,13 @@ import {
} from './constants'
import Request from './request'

const requestLog = debug('dubbo:decodeDubboRequest');
export function decodeDubboRequest(buff: Buffer): Request {
const log = debug('dubbo:decodeDubboRequest')

const flag = buff[2]
// get requestId
const requestId = byte.fromBytes8(buff.slice(4, 12))
log('decode requestId -> ', requestId)
requestLog('decode requestId -> ', requestId)
const req = new Request(requestId)

// decode request
@@ -96,9 +96,9 @@ export function decodeDubboRequest(buff: Buffer): Request {
return req
}

const responseLog = debug('dubbo:decodeDubboResponse')
//com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.encodeResponse/decode
export function decodeDubboResponse<T>(bytes: Buffer): IDubboResponse<T> {
const log = debug('dubbo:decodeDubboResponse')

let res = null
let err = null
@@ -108,7 +108,7 @@ export function decodeDubboResponse<T>(bytes: Buffer): IDubboResponse<T> {
//字节位置[4-11] 8 bytes
const requestIdBuff = bytes.slice(4, 12)
const requestId = byte.fromBytes8(requestIdBuff)
log(`decode parse requestId: ${requestId}`)
responseLog(`decode parse requestId: ${requestId}`)

const typeId = bytes[2]

@@ -124,7 +124,7 @@ export function decodeDubboResponse<T>(bytes: Buffer): IDubboResponse<T> {
// get response status.
const status = bytes[3]

log(
responseLog(
`parse response status: ${status}, DUBBO_RESPONSE_STATUS: ${
DUBBO_RESPONSE_STATUS[DUBBO_RESPONSE_STATUS.OK]
}`
@@ -145,7 +145,7 @@ export function decodeDubboResponse<T>(bytes: Buffer): IDubboResponse<T> {
// current status flag
const flag = body.readInt()

log(
responseLog(
`parse dubbo response body flag: ${flag}, DUBBO_RESPONSE_BODY_FLAG: ${DUBBO_RESPONSE_BODY_FLAG[flag]}`
)

0 comments on commit 0a0472b

Please sign in to comment.