1 /*
2 * atobj-rreq.cc --
3 *
4 * Atobj_request and Atobj_reply (for SRM reliability)
5 *
6 * Copyright (c) 1997-2002 The Regents of the University of California.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * A. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 * B. Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 * C. Neither the names of the copyright holders nor the names of its
18 * contributors may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
22 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 #ifndef MASH_ATOBJ_RREQ_CC
35 #define MASH_ATOBJ_RREQ_CC
36
37 #include "atobj-rreq.h"
38
39 #ifndef lint
40 static const char rcsid[] = "@(#) $Header: /usr/mash/src/repository/mash/mash-1/atobj/atobj-rreq.cc,v 1.9 2002/02/03 03:10:21 lim Exp $";
41 #endif
42
43 static const int cNumMaxRequest = 20; // cancel after asking for 10 times
44
45 /*virtual from SRM_Request*/
46 int Atobj_request::fill_ADU(Byte* pb, int len)
47 {
48 Trace(VERYVERBOSE,("request::fill_adu"));
49 // note that the request could be cancelled during updateRequest
50 if (pRcvr_->updateRequest(this, anmId_)) {
51 #if 0 // just let the timer increase to whatever for now....
52 // REVIEW what should be the right thing to do here?
53 numtimes_++;
54 if (numtimes_>cNumMaxRequest) {
55 // note: function will kill the object
56 pRcvr_->cancelRequest(this, anmId_, 1);
57 return 0;
58 }
59 #endif
60 backoff();
61 return (pRcvr_->fillRequest(this, anmId_, pb,len));
62 }
63 return 0;
64 }
65
66 int Atobj_reply::fill_ADU(Byte* pb, int len)
67 {
68 Trace(VERYVERBOSE,("repair::fill_adu"));
69 // Note that replies might have to go out in multiple packets.
70 // Assumption is receiver will cancel this reply after all the data
71 // has been sent out.
72 return pRcvr_->fillReply(this, anmId_, pb, len);
73 }
74
75 #endif /* #ifdef MASH_ATOBJ_RREQ_CC */
76
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.