Hello,
Zvone wrote:
> I found something that might also be issue with pop3 component.
>
> If you check one pop3 account and end the session usually LastResponse
> will be some ending message like "+OK sayonara". But if you then
> reinitialize pop3 for another account and this account fails to
> connect, for example due to timeout you get for example "-ERR
> Connection refused (Winsock error #10061)" but LastResponse is still
> "+OK sayonara" although it should be invalidated and set to empty
> string. Or, there should be IMO a method ClearLastResponse as
> LastResponse is not a writeable property right now. Checking on both
> messages (LastError and LastResponse) is useful for debugging purposes
> so they should be a possibility to manually (by calling
> "ClearLastResponse") or automatically invalidate LastResponse.
IMO the component should clear LastResponse on before connect.
>
> Furthermore, although Error code is accessible in for example
> OnRequestDone it is not accessible within the pop3 component and the
> code may sometimes be 10061 which is Winsock code or 500 which is pop3
> component code. Nothing that can't be done with little RegEx on
> LastError but why not publishing this as well?
So what about a numeric property LastErrorNumber?
[..]
> As for Throttle, it works but rather strangely. If I set limit to 1
> and timer to 1000 it should pass 1 byte every 1000ms and accumulate
> the rest in internal buffer right? Well it doesn't work like if you do
> something like SendStr("Some large string here") it will send entire
> string and then wait for 1000 ms rather than sending just one byte
> every 1000 ms. At least this is how throttle should work - send a
> maximum of Limit bytes every Timer interval and if more is available,
> store in internal buffer for sending later. It may be tricky to
> implement as data could accumulate in memory but not sure about that
> one.
It is neither intended to support such small values nor to work very
accurate. Currently, as Angus said, it doesn't control buffer sizes.
However the following should do the trick IMO, if I haven't missed
something, worth to be tested anyway:
function TCustomThrottledWSocket.RealSend(var Data: TWSocketData;
Len: Integer): Integer;
begin
if FBandwidthEnabled and (Len > 0) and
(FBandwidthCount + LongWord(Len) > FBandwidthMaxCount) then
Len := (FBandwidthMaxCount - FBandwidthCount) + 1; // Ensure Len > 0
Result := inherited RealSend(Data, Len);
if FBandwidthEnabled and (Result > 0) then begin
Inc(FBandwidthCount, Result);
if (FBandwidthCount >= FBandwidthMaxCount) and
(not FBandwidthPaused) then begin
FBandwidthPaused := TRUE;
Pause;
end;
end;
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function TCustomThrottledWSocket.Receive(Buffer: TWSocketData;
BufferSize: Integer): Integer;
begin
if FBandwidthEnabled and (BufferSize > 0) and
(FBandwidthCount + LongWord(BufferSize) > FBandwidthMaxCount) then
BufferSize := (FBandwidthMaxCount - FBandwidthCount) + 1; // Ensure
BufferSize > 0
Result := inherited Receive(Buffer, BufferSize);
if FBandwidthEnabled and (Result > 0) then begin
Inc(FBandwidthCount, Result);
if (FBandwidthCount > FBandwidthMaxCount) and
(not FBandwidthPaused) then begin
FBandwidthPaused := TRUE;
Pause;
end;
end;
end;
--
Arno Garrels
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be