event loop. overflooded counter cleanup on connection close.
This commit is contained in:
parent
426d5cedc6
commit
ccde7b309c
7
loop.go
7
loop.go
|
@ -97,6 +97,11 @@ func CloseChannel(c *Channel, m *methods, args ...interface{}) error {
|
||||||
c.out <- protocol.CloseMessage
|
c.out <- protocol.CloseMessage
|
||||||
|
|
||||||
m.callLoopEvent(c, OnDisconnection)
|
m.callLoopEvent(c, OnDisconnection)
|
||||||
|
|
||||||
|
overfloodedLock.Lock()
|
||||||
|
delete(overflooded, c)
|
||||||
|
overfloodedLock.Unlock()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +150,7 @@ outgoing messages loop, sends messages from channel to socket
|
||||||
func outLoop(c *Channel, m *methods) error {
|
func outLoop(c *Channel, m *methods) error {
|
||||||
for {
|
for {
|
||||||
outBufferLen := len(c.out)
|
outBufferLen := len(c.out)
|
||||||
if outBufferLen == queueBufferSize {
|
if outBufferLen >= queueBufferSize - 1 {
|
||||||
return CloseChannel(c, m, ErrorSocketOverflood)
|
return CloseChannel(c, m, ErrorSocketOverflood)
|
||||||
} else if outBufferLen > int(queueBufferSize/2) {
|
} else if outBufferLen > int(queueBufferSize/2) {
|
||||||
overfloodedLock.Lock()
|
overfloodedLock.Lock()
|
||||||
|
|
Loading…
Reference in New Issue