char *filename;
struct in_addr ipaddr, ipmask;
time_t beg;
- int i, status, ulreqs, expect, unexpected;
+ int i, status, ulreqs, expect, upload_ok;
struct ethsock *sock;
void (*sigh_orig)(int);
msg_hton(&tx.msg);
i = 0;
+ upload_ok = 0;
beg = time(NULL);
while (1) {
if (expect != NMRP_C_NONE && rx.msg.code != expect) {
fprintf(stderr, "Received %s while waiting for %s!\n",
msg_code_str(rx.msg.code), msg_code_str(expect));
- unexpected = 1;
- } else {
- unexpected = 0;
}
tx.msg.code = NMRP_C_NONE;
break;
case NMRP_C_TFTP_UL_REQ:
- if (!unexpected) {
+ if (!upload_ok) {
if (++ulreqs > 5) {
printf("Bailing out after %d upload requests.\n",
ulreqs);
if (!status) {
printf("OK\nWaiting for remote to respond.\n");
+ upload_ok = 1;
ethsock_set_timeout(sock, args->ul_timeout);
expect = NMRP_C_NONE;
} else if (status == -2) {