mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-07 02:09:59 +00:00
example: limit message size
This commit is contained in:
parent
980bb9cdd0
commit
e7fe3be34d
2 changed files with 9 additions and 0 deletions
|
|
@ -34,12 +34,17 @@ class Server
|
|||
@pk.reset
|
||||
@buffer.slice!(0, @nread)
|
||||
@nread = 0
|
||||
|
||||
next unless @buffer.empty?
|
||||
end
|
||||
|
||||
break
|
||||
end
|
||||
|
||||
if @buffer.length > 10*1024*1024
|
||||
raise "message is too large"
|
||||
end
|
||||
|
||||
rescue
|
||||
puts "error while processing client packet: #{$!}"
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue