lcore.org gitweb
/
lcore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
no longer by default call TimeBeginPeriod(1) in btime init
[lcore.git]
/
lcore.pas
diff --git
a/lcore.pas
b/lcore.pas
index d346c528b2fc045172d8428b709389b7c6db9695..097ea79c8946d7dda19c9e0a18c5b9f24473f6bd 100644
(file)
--- a/
lcore.pas
+++ b/
lcore.pas
@@
-106,6
+106,10
@@
interface
lasterror:integer;
\r
destroying:boolean;
\r
recvbufsize:integer;
\r
lasterror:integer;
\r
destroying:boolean;
\r
recvbufsize:integer;
\r
+ datasentcalled:boolean;
\r
+ {$ifdef mswindows}
\r
+ sendflushlasterror:integer;
\r
+ {$endif}
\r
function receivestr:tbufferstring; virtual;
\r
procedure close;
\r
procedure abort;
\r
function receivestr:tbufferstring; virtual;
\r
procedure close;
\r
procedure abort;
\r
@@
-484,12
+488,17
@@
begin
result := -1;
\r
exit;
\r
end;
\r
result := -1;
\r
exit;
\r
end;
\r
+ datasentcalled := false;
\r
\r
lensent := sendq.get(data,packetbasesize*2);
\r
if assigned(data) then result := myfdwrite(fdhandleout,data^,lensent) else result := 0;
\r
\r
if result = -1 then lensent := 0 else lensent := result;
\r
\r
\r
lensent := sendq.get(data,packetbasesize*2);
\r
if assigned(data) then result := myfdwrite(fdhandleout,data^,lensent) else result := 0;
\r
\r
if result = -1 then lensent := 0 else lensent := result;
\r
\r
+ {$ifdef mswindows}
\r
+ if (result = -1) then sendflushlasterror := getlasterror else sendflushlasterror := 0;
\r
+ {$endif}
\r
+
\r
//sendq := copy(sendq,lensent+1,length(sendq)-lensent);
\r
sendq.del(lensent);
\r
\r
//sendq := copy(sendq,lensent+1,length(sendq)-lensent);
\r
sendq.del(lensent);
\r
\r
@@
-562,14
+571,14
@@
begin
\r
end else begin
\r
{$ifdef mswindows}
\r
\r
end else begin
\r
{$ifdef mswindows}
\r
- if
get
lasterror=WSAEWOULDBLOCK then begin
\r
+ if
sendflush
lasterror=WSAEWOULDBLOCK then begin
\r
//the asynchronous nature of windows messages means we sometimes
\r
//get here with the buffer full
\r
//so do nothing in that case
\r
end else
\r
{$endif}
\r
begin
\r
//the asynchronous nature of windows messages means we sometimes
\r
//get here with the buffer full
\r
//so do nothing in that case
\r
end else
\r
{$endif}
\r
begin
\r
- internalclose({$ifdef mswindows}
get
lasterror{$else}linuxerror{$endif});
\r
+ internalclose({$ifdef mswindows}
sendflush
lasterror{$else}linuxerror{$endif});
\r
end
\r
end;
\r
end;
\r
end
\r
end;
\r
end;
\r
@@
-577,7
+586,13
@@
begin
end else begin
\r
//everything is sent fire off ondatasent event
\r
if fdhandleout >= 0 then eventcore.wmasterclr(fdhandleout);//fd_clr(fdhandleout,fdswmaster);
\r
end else begin
\r
//everything is sent fire off ondatasent event
\r
if fdhandleout >= 0 then eventcore.wmasterclr(fdhandleout);//fd_clr(fdhandleout,fdswmaster);
\r
- if assigned(ondatasent) then tltask.create(self.dodatasent,self,0,0);
\r
+ if assigned(ondatasent) then begin
\r
+ if not datasentcalled then begin
\r
+ tltask.create(self.dodatasent,self,0,0);
\r
+ datasentcalled := true;
\r
+ end;
\r
+ end;
\r
+
\r
end;
\r
if assigned(onfdwrite) then onfdwrite(self,0);
\r
end;
\r
end;
\r
if assigned(onfdwrite) then onfdwrite(self,0);
\r
end;
\r