Clear a pending packet when it times out or is successfully received.
function clearRequest(reqs, reqid) {
    var self = this;

    var entry = reqs[reqid];
    if (entry) {
        if (entry.timeout) {
            clearTimeout(entry.timeout);
        }
        delete reqs[reqid];
    }
}