From 83146c1d833b13e7fc5438f50ec33c874a98edf2 Mon Sep 17 00:00:00 2001 From: David Gobaud Date: Sat, 11 Jan 2014 05:37:22 -0500 Subject: [PATCH] change readpartial to readline change readpartial to readline because readpartial can return before it reads a whole line and that messes up process_line --- lib/mini-smtp-server/mini-smtp-server.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mini-smtp-server/mini-smtp-server.rb b/lib/mini-smtp-server/mini-smtp-server.rb index 3229ce3..74aa087 100644 --- a/lib/mini-smtp-server/mini-smtp-server.rb +++ b/lib/mini-smtp-server/mini-smtp-server.rb @@ -13,10 +13,10 @@ def serve(io) io.print "220 hello\r\n" loop do if IO.select([io], nil, nil, 0.1) - data = io.readpartial(4096) + data = io.readline() log("<<< " + data) if(@audit) output = process_line(data) - log(">>> " + output) if(@audit && !output.empty?) + log(">>> " + output) if(@audit && !output.empty?) io.print(output) unless output.empty? end break if(!Thread.current[:connection_active] || io.closed?)