Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Sam Moggach
    @ezmicken
    any idea why a tcp connection might spam 0's indefinitely?
    Sam Moggach
    @ezmicken
    turns out i failed to count the bytes properly and couldn't realize it until I complain! oof.
    loving gnet btw nice work :thumbsup:
    Andy Pan
    @panjf2000
    just see this message and glad you've worked it out.
    the notifications from gitter seem to be a bit belated, I would find a way to solve this problem.
    Sam Moggach
    @ezmicken

    The problem came back so I rolled back my changes and confirmed they caused it.
    The culprit:

    reader.Peek(1)
    reader.Discard(1)

    to

    reader.ReadByte
    Andy Pan
    @panjf2000
    it's a bit hard to figure out the root cause based on this code snippet, maybe provide the whole codec?
    Sam Moggach
    @ezmicken
    sorry, nothing to do with gnet actually. I am using a bufio.Reader to read from a net.TCPConn. I call Peek(4)/Discard(4) to read how many bytes there are, then Peek(1)/Discard(1) until all those bytes are read.
    If I changed the second operation to ReadByte() then even after all the bytes are read any peek/read finds a 0 in the buffer indefinitely, as opposed to nothing like it did before. I thought I was actually spamming the stream with zeroes (with gnet server) but as soon as i put it back to Peek(1)/Discard(1) the problem went away.
    Andy Pan
    @panjf2000
    ok, then I guess we can pass this issue.
    garfield009
    @garfield009
    没有对应的客户端吗? @panjf2000
    Andy Pan
    @panjf2000
    目前没有
    garfield009
    @garfield009
    哦,好的,谢谢。