OLD | NEW |
1 /* Copyright (c) 2015-2016 Stanford University | 1 /* Copyright (c) 2015-2017 Stanford University |
2 * | 2 * |
3 * Permission to use, copy, modify, and distribute this software for any purpose | 3 * Permission to use, copy, modify, and distribute this software for any purpose |
4 * with or without fee is hereby granted, provided that the above copyright | 4 * with or without fee is hereby granted, provided that the above copyright |
5 * notice and this permission notice appear in all copies. | 5 * notice and this permission notice appear in all copies. |
6 * | 6 * |
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES | 7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES |
8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR | 9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR |
10 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 10 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 * Used to send and receive packets. This transport becomes owner | 52 * Used to send and receive packets. This transport becomes owner |
53 * of the driver and will free it in when this object is deleted. | 53 * of the driver and will free it in when this object is deleted. |
54 * \param clientId | 54 * \param clientId |
55 * Identifier that identifies us in outgoing RPCs: must be unique across | 55 * Identifier that identifies us in outgoing RPCs: must be unique across |
56 * all servers and clients. | 56 * all servers and clients. |
57 */ | 57 */ |
58 BasicTransport::BasicTransport(Context* context, const ServiceLocator* locator, | 58 BasicTransport::BasicTransport(Context* context, const ServiceLocator* locator, |
59 Driver* driver, uint64_t clientId) | 59 Driver* driver, uint64_t clientId) |
60 : context(context) | 60 : context(context) |
61 , driver(driver) | 61 , driver(driver) |
| 62 , locatorString("basic+"+driver->getServiceLocator()) |
62 , poller(context, this) | 63 , poller(context, this) |
63 , maxDataPerPacket(driver->getMaxPacketSize() - sizeof32(DataHeader)) | 64 , maxDataPerPacket(driver->getMaxPacketSize() - sizeof32(DataHeader)) |
64 , clientId(clientId) | 65 , clientId(clientId) |
65 , nextClientSequenceNumber(1) | 66 , nextClientSequenceNumber(1) |
66 , nextServerSequenceNumber(1) | 67 , nextServerSequenceNumber(1) |
67 , transmitSequenceNumber(1) | 68 , transmitSequenceNumber(1) |
68 , receivedPackets() | 69 , receivedPackets() |
69 , serverRpcPool() | 70 , serverRpcPool() |
70 , clientRpcPool() | 71 , clientRpcPool() |
71 , outgoingRpcs() | 72 , outgoingRpcs() |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // Advance iterator; otherwise it will get invalidated by | 119 // Advance iterator; otherwise it will get invalidated by |
119 // deleteServerRpc. | 120 // deleteServerRpc. |
120 it++; | 121 it++; |
121 deleteServerRpc(serverRpc); | 122 deleteServerRpc(serverRpc); |
122 } | 123 } |
123 for (ClientRpcMap::iterator it = outgoingRpcs.begin(); | 124 for (ClientRpcMap::iterator it = outgoingRpcs.begin(); |
124 it != outgoingRpcs.end(); it++) { | 125 it != outgoingRpcs.end(); it++) { |
125 ClientRpc* clientRpc = it->second; | 126 ClientRpc* clientRpc = it->second; |
126 deleteClientRpc(clientRpc); | 127 deleteClientRpc(clientRpc); |
127 } | 128 } |
128 delete driver; | |
129 } | 129 } |
130 | 130 |
131 // See Transport::getServiceLocator(). | 131 // See Transport::getServiceLocator(). |
132 string | 132 string |
133 BasicTransport::getServiceLocator() | 133 BasicTransport::getServiceLocator() |
134 { | 134 { |
135 return driver->getServiceLocator(); | 135 return locatorString; |
136 } | 136 } |
137 | 137 |
138 /* | 138 /* |
139 * When we are finished processing an outgoing RPC, this method is | 139 * When we are finished processing an outgoing RPC, this method is |
140 * invoked to delete the ClientRpc object and remove it from all | 140 * invoked to delete the ClientRpc object and remove it from all |
141 * existing data structures. | 141 * existing data structures. |
142 * | 142 * |
143 * \param clientRpc | 143 * \param clientRpc |
144 * An RPC that has either completed normally or is being | 144 * An RPC that has either completed normally or is being |
145 * aborted. | 145 * aborted. |
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 if ((serverRpc->silentIntervals >= 2) && !serverRpc->requestComplete) { | 1551 if ((serverRpc->silentIntervals >= 2) && !serverRpc->requestComplete) { |
1552 serverRpc->resendLimit = | 1552 serverRpc->resendLimit = |
1553 serverRpc->accumulator->requestRetransmission(this, | 1553 serverRpc->accumulator->requestRetransmission(this, |
1554 serverRpc->clientAddress, serverRpc->rpcId, | 1554 serverRpc->clientAddress, serverRpc->rpcId, |
1555 serverRpc->grantOffset, roundTripBytes, FROM_SERVER); | 1555 serverRpc->grantOffset, roundTripBytes, FROM_SERVER); |
1556 } | 1556 } |
1557 } | 1557 } |
1558 } | 1558 } |
1559 | 1559 |
1560 } // namespace RAMCloud | 1560 } // namespace RAMCloud |
OLD | NEW |