lcore.org gitweb
/
lcore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
allow opt out of win8 api method for program that needs old method
[lcore.git]
/
lcore.pas
diff --git
a/lcore.pas
b/lcore.pas
old mode 100755
(executable)
new mode 100644
(file)
index
c936b59
..
097ea79
--- a/
lcore.pas
+++ b/
lcore.pas
@@
-45,7
+45,7
@@
interface
receivebufsize=packetbasesize*8;
\r
\r
var
\r
receivebufsize=packetbasesize*8;
\r
\r
var
\r
- absol
o
utemaxs:integer=0;
\r
+ absolutemaxs:integer=0;
\r
\r
type
\r
{$ifdef ver1_0}
\r
\r
type
\r
{$ifdef ver1_0}
\r
@@
-84,8
+84,8
@@
interface
public
\r
state : tsocketstate ;
\r
ComponentOptions : TWSocketOptions;
\r
public
\r
state : tsocketstate ;
\r
ComponentOptions : TWSocketOptions;
\r
- fdhandlein : Longint ; {file d
i
scriptor}
\r
- fdhandleout : Longint ; {file d
i
scriptor}
\r
+ fdhandlein : Longint ; {file d
e
scriptor}
\r
+ fdhandleout : Longint ; {file d
e
scriptor}
\r
\r
onsessionclosed : tsocketevent ;
\r
ondataAvailable : tsocketevent ;
\r
\r
onsessionclosed : tsocketevent ;
\r
ondataAvailable : tsocketevent ;
\r
@@
-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
@@
-164,7
+168,7
@@
interface
// finitialevent : boolean ;
\r
fontimer : tnotifyevent ;
\r
fenabled : boolean ;
\r
// finitialevent : boolean ;
\r
fontimer : tnotifyevent ;
\r
fenabled : boolean ;
\r
- finterval : integer ; {miliseconds, default 1000}
\r
+ finterval : integer ; {mil
l
iseconds, default 1000}
\r
{$ifndef mswindows}
\r
procedure resettimes;
\r
{$endif}
\r
{$ifndef mswindows}
\r
procedure resettimes;
\r
{$endif}
\r
@@
-173,7
+177,7
@@
interface
procedure setenabled(newvalue : boolean);
\r
procedure setinterval(newvalue : integer);
\r
public
\r
procedure setenabled(newvalue : boolean);
\r
procedure setinterval(newvalue : integer);
\r
public
\r
- //making the
ese public for now, this code should probabl
ly be restructured later though
\r
+ //making the
se public for now, this code should probab
ly be restructured later though
\r
prevtimer : tltimer ;
\r
nexttimer : tltimer ;
\r
nextts : ttimeval ;
\r
prevtimer : tltimer ;
\r
nexttimer : tltimer ;
\r
nextts : ttimeval ;
\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
@@
-590,7
+605,7
@@
begin
if (numread=0) and (not mustrefreshfds) then begin
\r
{if i remember correctly numread=0 is caused by eof
\r
if this isn't dealt with then you get a cpu eating infinite loop
\r
if (numread=0) and (not mustrefreshfds) then begin
\r
{if i remember correctly numread=0 is caused by eof
\r
if this isn't dealt with then you get a cpu eating infinite loop
\r
- however if onsessioncon
en
cted has called processmessages that could
\r
+ however if onsessioncon
ne
cted has called processmessages that could
\r
cause us to drop to here with an empty recvq and nothing left to read
\r
and we don't want that to cause the socket to close}
\r
\r
cause us to drop to here with an empty recvq and nothing left to read
\r
and we don't want that to cause the socket to close}
\r
\r
@@
-834,7
+849,7
@@
begin
end else begin
\r
currenttasklocal := currenttask; //needed in case called from a task
\r
end;
\r
end else begin
\r
currenttasklocal := currenttask; //needed in case called from a task
\r
end;
\r
- // note i don't bother to
s
estroy the links here as that will happen when
\r
+ // note i don't bother to
d
estroy the links here as that will happen when
\r
// the list of tasks is processed anyway
\r
while assigned(currenttasklocal) do begin
\r
if currenttasklocal.obj = aobj then begin
\r
// the list of tasks is processed anyway
\r
while assigned(currenttasklocal) do begin
\r
if currenttasklocal.obj = aobj then begin
\r