Git Product home page Git Product logo

Comments (2)

raptium avatar raptium commented on May 18, 2024

We now have a quick and dirty fix in 1926856.

Maybe we should refactor the HTTP protocol implementation to get a better resolution.

from starlight.

haijunzou1985 avatar haijunzou1985 commented on May 18, 2024

那这次请求,是没有返回的,客户端直接报异常?解析不出请求,break了(NotEnoughDataException)。这个框架,是不是没有拆包,粘包的解决方案?
public void channelRead0(ChannelHandlerContext ctx, Object in) throws Exception {
ChannelInfo channelInfo = ChannelInfo.getServerChannelInfo(ctx.channel());
ByteBuf msg = (ByteBuf) in;
int len = msg.readableBytes();
if (len > 0) {
channelInfo.getRecvBuf().addBuffer(msg.retain());
DecodeWorkTask[] tasks = new DecodeWorkTask[64];
int i = 0;
while (channelInfo.getRecvBuf().readableBytes() > 0) {
try {
Object packet = decodeHeader(ctx, channelInfo, channelInfo.getRecvBuf());
DecodeWorkTask task = new DecodeWorkTask(rpcServer, packet, channelInfo.getProtocol(), ctx);
tasks[i++] = task;
if (i == 64) {
rpcServer.getThreadPool().submit(tasks, 0, i);
i = 0;
}
} catch (NotEnoughDataException ex1) {
break;
} catch (TooBigDataException ex2) {
throw new RpcException(RpcException.SERIALIZATION_EXCEPTION, ex2);
} catch (BadSchemaException ex3) {
throw new RpcException(RpcException.SERIALIZATION_EXCEPTION, ex3);
}
}
if (i > 0) {
rpcServer.getThreadPool().submit(tasks, 0, i);

        }
    }
}

from starlight.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.