* file named AUTHORS, in the root directory of this distribution.
*/
/*
- * $Id: protocol.c,v 1.27.2.1.6.3 2004/04/14 13:24:35 martinea Exp $
+ * $Id: protocol.c,v 1.27.2.1.6.2.2.2 2004/04/14 13:24:17 martinea Exp $
*
* implements amanda protocol
*/
case P_BOGUS: return "P_BOGUS";
case P_REQ: return "P_REQ";
case P_REP: return "P_REP";
+ case P_PREP: return "P_PREP";
case P_ACK: return "P_ACK";
case P_NAK: return "P_NAK";
default:
if(strcmp(typestr, "REQ") == 0) pkt->type = P_REQ;
else if(strcmp(typestr, "REP") == 0) pkt->type = P_REP;
+ else if(strcmp(typestr, "PREP") == 0) pkt->type = P_PREP;
else if(strcmp(typestr, "ACK") == 0) pkt->type = P_ACK;
else if(strcmp(typestr, "NAK") == 0) pkt->type = P_NAK;
else pkt->type = P_BOGUS;
p->state = S_REPWAIT;
break;
}
+ else if(pkt->type == P_PREP) {
+ /* no ack, just rep */
+ p->state = S_REPWAIT;
+ break;
+ }
/* else unexpected packet, put back on queue */
pending_enqueue(p);
return;
else if(action != A_RCVDATA)
goto badaction;
/* got the packet with the right handle, now check it */
- if(pkt->type != P_REP) {
+ if(pkt->type != P_REP && pkt->type != P_PREP) {
+ pending_enqueue(p);
+ return;
+ }
+ if(pkt->type == P_REP) {
+ send_ack(p);
+ p->state = S_SUCCEEDED;
+ free_handle(p);
+ p->continuation(p, pkt);
+ amfree(p->req);
+ amfree(p->security);
+ amfree(p);
+ return;
+ }
+ else if(pkt->type == P_PREP) {
+ p->state = S_REPWAIT;
+ p->continuation(p, pkt);
pending_enqueue(p);
return;
}
- send_ack(p);
- p->state = S_SUCCEEDED;
- free_handle(p);
- p->continuation(p, pkt);
- amfree(p->req);
- amfree(p->security);
- amfree(p);
- return;
default:
badaction:
if(errno == EAGAIN)
return;
#endif
-
fprintf(stderr,"protocol packet receive: %s\n", strerror(errno));
}