#include "rx/rx_kernel.h"
#include "rx/rx_clock.h"
#include "rx/rx_queue.h"
+#include "rx/rx_internal.h"
#include "rx/rx.h"
#include "rx/rx_globals.h"
#include "afs/lock.h"
# include "rx_user.h"
# include "rx_clock.h"
# include "rx_queue.h"
+# include "rx_internal.h"
# include "rx.h"
# include "rx_globals.h"
#endif /* KERNEL */
call->curpos = tcurpos + sizeof(afs_int32);
call->curlen = (u_short)(tcurlen - sizeof(afs_int32));
call->nLeft = (u_short)(tnLeft - sizeof(afs_int32));
- if (!call->nLeft) {
+ if (!call->nLeft && call->currentPacket != NULL) {
/* out of packet. Get another one. */
NETPRI;
MUTEX_ENTER(&call->lock);
do {
if (call->nFree == 0) {
if (!call->error && cp) {
+ /* Clear the current packet now so that if
+ * we are forced to wait and drop the lock
+ * the packet we are planning on using
+ * cannot be freed.
+ */
+ cp->flags &= ~RX_PKTFLAG_CP;
+ call->currentPacket = (struct rx_packet *)0;
#ifdef AFS_GLOBAL_RXLOCK_KERNEL
/* Wait until TQ_BUSY is reset before adding any
* packets to the transmit queue
* conn->securityMaxTrailerSize */
hadd32(call->bytesSent, cp->length);
rxi_PrepareSendPacket(call, cp, 0);
- cp->flags &= ~RX_PKTFLAG_CP;
cp->flags |= RX_PKTFLAG_TQ;
queue_Append(&call->tq, cp);
- cp = call->currentPacket = (struct rx_packet *)0;
+ cp = (struct rx_packet *)0;
if (!
(call->
flags & (RX_CALL_FAST_RECOVER |
RX_CALL_FAST_RECOVER_WAIT))) {
rxi_Start(0, call, 0, 0);
}
- } else else if (cp) {
+ } else if (cp) {
cp->flags &= ~RX_PKTFLAG_CP;
rxi_FreePacket(cp);
cp = call->currentPacket = (struct rx_packet *)0;
rxi_PrepareSendPacket(call, cp, 0);
cp->flags |= RX_PKTFLAG_TQ;
queue_Append(&tmpq, cp);
+ cp = call->currentPacket = (struct rx_packet *)0;
/* The head of the iovq is now the current packet */
if (nbytes) {
if (cp) {
cp->flags &= ~RX_PKTFLAG_CP;
queue_Prepend(&tmpq, cp);
+ cp = call->currentPacket = (struct rx_packet *)0;
}
rxi_FreePackets(0, &tmpq);
return 0;
if (cp) {
cp->flags &= ~RX_PKTFLAG_CP;
rxi_FreePacket(cp);
+ cp = call->currentPacket = (struct rx_packet *)0;
}
return 0;
}