Skip to content
Open
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
17 changes: 0 additions & 17 deletions natpmpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,6 @@ void usage(FILE * out, const char * argv0)
" To remove all mappings for your machine, use 0 as private port and lifetime.\n", argv0, argv0, argv0);
}

static void handlenatpmpbadreplytype(natpmp_t* pnatpmp, const natpmpresp_t* presponse, int* preturncode){
char retry = (pnatpmp->try_number <= 9);
printf("readnatpmpresponseorretry received unexpected reply type %hu , %s...\n", presponse->type, (retry == 1 ? "retrying" : "no more retry"));
if (retry) {
*preturncode = NATPMP_TRYAGAIN;
pnatpmp->has_pending_request = 1;
}
}

/* sample code for using libnatpmp */
int main(int argc, char * * argv)
{
Expand Down Expand Up @@ -236,9 +227,6 @@ int main(int argc, char * * argv)
fprintf(stderr, " errno=%d '%s'\n",
sav_errno, strerror(sav_errno));
}
if (r >= 0 && response.type != 0) {
handlenatpmpbadreplytype(&natpmp, &response, &r);
}
} while(r==NATPMP_TRYAGAIN);
if(r<0)
return 1;
Expand Down Expand Up @@ -274,11 +262,6 @@ int main(int argc, char * * argv)
r = readnatpmpresponseorretry(&natpmp, &response);
printf("readnatpmpresponseorretry returned %d (%s)\n",
r, r==0?"OK":(r==NATPMP_TRYAGAIN?"TRY AGAIN":"FAILED"));
if (r >= 0 && (
protocol == NATPMP_PROTOCOL_TCP && response.type != NATPMP_RESPTYPE_TCPPORTMAPPING ||
protocol == NATPMP_PROTOCOL_UDP && response.type != NATPMP_RESPTYPE_UDPPORTMAPPING)) {
handlenatpmpbadreplytype(&natpmp, &response, &r);
}
} while(r==NATPMP_TRYAGAIN);
if(r<0) {
#ifdef ENABLE_STRNATPMPERR
Expand Down