if( _ready_state == DONE )
cb(this);
else
- _cb_done = cb;
+ _cb_done.push_back(cb);
return this;
}
if( _ready_state == FAILED )
cb(this);
else
- _cb_fail = cb;
+ _cb_fail.push_back(cb);
return this;
}
if( isComplete() )
cb(this);
else
- _cb_always = cb;
+ _cb_always.push_back(cb);
return this;
}
{
_responseStatus = code;
_responseReason = reason;
- setReadyState(FAILED);
+
+ if( !isComplete() )
+ setReadyState(FAILED);
}
//------------------------------------------------------------------------------
onDone();
onAlways();
- if( _cb_done )
- _cb_done(this);
+ _cb_done(this);
}
else if( state == FAILED )
{
onFail();
onAlways();
- if( _cb_fail )
- _cb_fail(this);
+ _cb_fail(this);
}
else
return;
- if( _cb_always )
- _cb_always(this);
+ _cb_always(this);
}
//------------------------------------------------------------------------------
//----------------------------------------------------------------------------
void Request::abort(const std::string& reason)
{
- if( isComplete() )
- return;
-
setFailure(-1, reason);
_willClose = true;
}