mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-17 19:25:54 +02:00
example: limit message size
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user