Skip to content
This repository has been archived by the owner on Mar 3, 2021. It is now read-only.

Close socket when client sends EOF #58

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ Style/Documentation:
Enabled: false

Metrics/AbcSize:
Max: 40
Max: 45

Metrics/CyclomaticComplexity:
Max: 15
Max: 16

Metrics/MethodLength:
Max: 45

Metrics/PerceivedComplexity:
Max: 15
Max: 16

Metrics/BlockLength:
Exclude:
Expand Down
12 changes: 7 additions & 5 deletions lib/fake_ftp/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ def start
debug('enter request thread')
while @started && !socket.nil? && !socket.closed?
input = begin
socket.gets
rescue
debug("error on socket.gets: #{e}")
nil
end
socket.close && break if socket.eof?
socket.gets
rescue
debug("error on socket.gets: #{e}")
nil
end

if input
debug("server client raw: <- #{input.inspect}")
respond_with(handle_request(input))
Expand Down