tests/server/tftpd.c: fix include and enhance debug logging
setjmp.h should only be included if HAVE_SETJMP_H is defined. Add additional log statements to see wether reads and writes are blocking or finishing before an alarm signal is received. Assisted-by: Peter Wu Part of #5364
This commit is contained in:
Родитель
6f63ab41b2
Коммит
000f721690
|
@ -78,7 +78,9 @@
|
||||||
#include <sys/filio.h>
|
#include <sys/filio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SETJMP_H
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_PWD_H
|
#ifdef HAVE_PWD_H
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
@ -1183,8 +1185,9 @@ static void sendtftp(struct testcase *test, struct formats *pf)
|
||||||
}
|
}
|
||||||
|
|
||||||
send_data:
|
send_data:
|
||||||
|
logmsg("write");
|
||||||
if(swrite(peer, sdp, size + 4) != size + 4) {
|
if(swrite(peer, sdp, size + 4) != size + 4) {
|
||||||
logmsg("write");
|
logmsg("write: fail");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
read_ahead(test, pf->f_convert);
|
read_ahead(test, pf->f_convert);
|
||||||
|
@ -1192,7 +1195,9 @@ static void sendtftp(struct testcase *test, struct formats *pf)
|
||||||
#ifdef HAVE_ALARM
|
#ifdef HAVE_ALARM
|
||||||
alarm(rexmtval); /* read the ack */
|
alarm(rexmtval); /* read the ack */
|
||||||
#endif
|
#endif
|
||||||
|
logmsg("read");
|
||||||
n = sread(peer, &ackbuf.storage[0], sizeof(ackbuf.storage));
|
n = sread(peer, &ackbuf.storage[0], sizeof(ackbuf.storage));
|
||||||
|
logmsg("read: %zd", n);
|
||||||
#ifdef HAVE_ALARM
|
#ifdef HAVE_ALARM
|
||||||
alarm(0);
|
alarm(0);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1252,8 +1257,9 @@ static void recvtftp(struct testcase *test, struct formats *pf)
|
||||||
(void) sigsetjmp(timeoutbuf, 1);
|
(void) sigsetjmp(timeoutbuf, 1);
|
||||||
#endif
|
#endif
|
||||||
send_ack:
|
send_ack:
|
||||||
|
logmsg("write");
|
||||||
if(swrite(peer, &ackbuf.storage[0], 4) != 4) {
|
if(swrite(peer, &ackbuf.storage[0], 4) != 4) {
|
||||||
logmsg("write: fail\n");
|
logmsg("write: fail");
|
||||||
goto abort;
|
goto abort;
|
||||||
}
|
}
|
||||||
write_behind(test, pf->f_convert);
|
write_behind(test, pf->f_convert);
|
||||||
|
@ -1261,14 +1267,16 @@ send_ack:
|
||||||
#ifdef HAVE_ALARM
|
#ifdef HAVE_ALARM
|
||||||
alarm(rexmtval);
|
alarm(rexmtval);
|
||||||
#endif
|
#endif
|
||||||
|
logmsg("read");
|
||||||
n = sread(peer, rdp, PKTSIZE);
|
n = sread(peer, rdp, PKTSIZE);
|
||||||
|
logmsg("read: %zd", n);
|
||||||
#ifdef HAVE_ALARM
|
#ifdef HAVE_ALARM
|
||||||
alarm(0);
|
alarm(0);
|
||||||
#endif
|
#endif
|
||||||
if(got_exit_signal)
|
if(got_exit_signal)
|
||||||
goto abort;
|
goto abort;
|
||||||
if(n < 0) { /* really? */
|
if(n < 0) { /* really? */
|
||||||
logmsg("read: fail\n");
|
logmsg("read: fail");
|
||||||
goto abort;
|
goto abort;
|
||||||
}
|
}
|
||||||
rdp->th_opcode = ntohs((unsigned short)rdp->th_opcode);
|
rdp->th_opcode = ntohs((unsigned short)rdp->th_opcode);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче