ftp: reconnect on tcp read error

This commit reconnect both connections and retries before ftp_read returns an error.
Practical use case: resume after lock screen on iOS devices.

Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
ftp: fix flush control connection input

Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
ftp: explicit return code checks

Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
ftp: abort function optimalization

It seems some ftp servers doesn't respect ABOR command,
but closing both connection is slow.

This commit keeps control connection open when possible.

Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
ftp: fix seeking beyond file size

adjust to ff* tools seek nature

Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
ftp: probe seek capability

Make FTP streamed when server doesn't accept REST command

Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
ftp: add invalid code for RETR operation

554 is possible invalid code:
- Restart not valid
- Command terminated due to server shutdown in progress
- etc...

Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
Merge remote-tracking branch 'lukaszmluki/master'

* lukaszmluki/master:
  ftp: add invalid code for RETR operation
  ftp: probe seek capability
  ftp: fix seeking beyond file size
  ftp: abort function optimalization
  ftp: explicit return code checks
  ftp: fix flush control connection input
  ftp: reconnect on tcp read error

Merged-by: Michael Niedermayer <michaelni@gmx.at>