AutoBuffer call(AutoBuffer ab) { int tnum = ab.getTask(); RPC<?> t = ab._h2o.taskGet(tnum); assert t== null || t._tasknum == tnum; if( t != null ) t.response(ab); // Do the 2nd half of this task, includes ACKACK else ab.close(); // Else forgotten task, but still must ACKACK return new AutoBuffer(ab._h2o).putTask(UDP.udp.ackack.ordinal(),tnum); }
final void resend_ack() { assert _computedAndReplied : "Found RPCCall not computed "+_tsknum; DTask dt = _dt; if( dt == null ) return; // Received ACKACK already UDP.udp udp = dt.priority()==H2O.FETCH_ACK_PRIORITY ? UDP.udp.fetchack : UDP.udp.ack; AutoBuffer rab = new AutoBuffer(_client).putTask(udp,_tsknum); boolean wasTCP = dt._repliedTcp; if( wasTCP ) rab.put1(RPC.SERVER_TCP_SEND) ; // Original reply sent via TCP else dt.write(rab.put1(RPC.SERVER_UDP_SEND)); // Original reply sent via UDP assert sz_check(rab) : "Resend of "+_dt.getClass()+" changes size from "+_size+" to "+rab.size(); assert dt._repliedTcp==wasTCP; rab.close(); // Double retry until we exceed existing age. This is the time to delay // until we try again. Note that we come here immediately on creation, // so the first doubling happens before anybody does any waiting. Also // note the generous 5sec cap: ping at least every 5 sec. _retry += (_retry < 5000 ) ? _retry : 5000; } @Override public byte priority() { return _dt.priority(); }
ab = new AutoBuffer(_client).putTask(udp,_tsknum).put1(SERVER_UDP_SEND);
new AutoBuffer(ab._h2o).putTask(UDP.udp.ackack.ordinal(),task).close();
AutoBuffer ab = new AutoBuffer(_target); try { ab.putTask(UDP.udp.exec,_tasknum).put1(CLIENT_UDP_SEND).put(_dt); boolean t = ab.hasTCP(); assert sz_check(ab) : "Resend of "+_dt.getClass()+" changes size from "+_size+" to "+ab.size()+" for task#"+_tasknum; AutoBuffer ab = new AutoBuffer(_target).putTask(UDP.udp.exec,_tasknum); ab.put1(CLIENT_TCP_SEND).close();