nopnop2002 / esp-idf-ftpClient

ftp client for esp-idf
37 stars 7 forks source link

Feedback about quitFtpClient member function #6

Closed idea--list closed 1 year ago

idea--list commented 2 years ago

Hi there,

While trying the repo i found this inside FtpClient.c

/*
 * quitFtpClient - disconnect from remote
 *
 * return 1 if successful, 0 otherwise
 */
static void quitFtpClient(NetBuf_t* nControl)
{
    if (nControl->dir != FTP_CLIENT_CONTROL)
        return;
    sendCommand("QUIT", '2', nControl);
    closesocket(nControl->handle);
    free(nControl->buf);
    free(nControl);
}

It works perfectly fine except it does not return 0 or 1 as it is a void function. Unlike in case of other member functions, this makes it hard to check in a program flow if disconnection was successful or not. I just guess there is not much that could go wrong with disconnection in which case a void funtion is perfectly fine, just the description is ambiguing in that case. If however there might be errors during disconnection, then this function should not be void.

nopnop2002 commented 2 years ago

Thank you for your report. Will fix in the near future.