MARS icon indicating copy to clipboard operation
MARS copied to clipboard

procedure TMARSIndyClient.AssignTo should clone IOHandler

Open littleearth opened this issue 6 years ago • 2 comments

I have found issues arise if a mix of Sync and Async calls are made; an initial fix is to add DELETEAsync as per issue #26

I have found by commenting out the following line in procedure TMARSIndyClient.AssignTo(Dest: TPersistent) resolves the issue.

LDestClient.HttpClient.IOHandler := HttpClient.IOHandler;

Should the IOHandler not be transferred or cloned.

The way IOHandler works in indy, is if it is not set the IOHandler will be NIL the first time an AssignTo is called, however once a HTTP request (not ASYNC in MARS) is made the IOHandler will have an internal IOHandler.

Indy Connect Code

image

littleearth avatar May 10 '18 05:05 littleearth

Hi, what kind of issues are you encountering? I decided to copy (maybe it is better to clone it) the IOHandler mostly because if you are using the SSL IOHandler (probably with some properties set) you will need it also for async calls. Aside of this, I tend to use the NetHttpClient implementation when https is required (often, these day), see TMARSNetClient.

Sincerely,

andrea-magni avatar May 10 '18 06:05 andrea-magni

The connection will error with " Not Connected." or "Socket Error # 10038 Socket operation on non-socket"

Thanks for tip on TMARSNetClient I have changed to this for testing for now.

littleearth avatar May 10 '18 07:05 littleearth