|
@@ -66,8 +66,12 @@ func (cc *IRCReader) ReadLine() ([]byte, error) {
|
66
|
66
|
return line, nil
|
67
|
67
|
}
|
68
|
68
|
|
69
|
|
- if cc.start == 0 && len(cc.buf) == cc.maxSize {
|
70
|
|
- return nil, ErrReadQ // out of space, can't expand or slide
|
|
69
|
+ // are we out of space? we can read more if any of these are true:
|
|
70
|
+ // 1. cc.start != 0, so we can slide the existing data back
|
|
71
|
+ // 2. cc.end < len(cc.buf), so we can read data into the end of the buffer
|
|
72
|
+ // 3. len(cc.buf) < cc.maxSize, so we can grow the buffer
|
|
73
|
+ if cc.start == 0 && cc.end == len(cc.buf) && len(cc.buf) == cc.maxSize {
|
|
74
|
+ return nil, ErrReadQ
|
71
|
75
|
}
|
72
|
76
|
|
73
|
77
|
if cc.eof {
|