* FtpWrite - write to a data connection */
| 916 | * FtpWrite - write to a data connection |
| 917 | */ |
| 918 | GLOBALDEF int FtpWrite(const void *buf, int len, netbuf *nData) { |
| 919 | int i; |
| 920 | if (nData->dir != FTPLIB_WRITE) |
| 921 | return 0; |
| 922 | if (nData->buf) |
| 923 | i = writeline((char *) buf, len, nData); |
| 924 | else { |
| 925 | socket_wait(nData); |
| 926 | i = net_write(nData->handle, (char *) buf, len); |
| 927 | } |
| 928 | if (i == -1) |
| 929 | return 0; |
| 930 | nData->xfered += i; |
| 931 | if (nData->idlecb && nData->cbbytes) { |
| 932 | nData->xfered1 += i; |
| 933 | if (nData->xfered1 > nData->cbbytes) { |
| 934 | nData->idlecb(nData, nData->xfered, nData->idlearg); |
| 935 | nData->xfered1 = 0; |
| 936 | } |
| 937 | } |
| 938 | return i; |
| 939 | } |
| 940 | |
| 941 | /* |
| 942 | * FtpClose - close a data connection |
no test coverage detected