lcore.org gitweb
/
lcore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
the big lot of changes by beware
[lcore.git]
/
lcorewsaasyncselect.pas
diff --git
a/lcorewsaasyncselect.pas
b/lcorewsaasyncselect.pas
index a978c232f91f334a19719ca6e146ba189ea28ed8..3f55f1a22470d0c706ed57cb691d96628c162804 100755
(executable)
--- a/
lcorewsaasyncselect.pas
+++ b/
lcorewsaasyncselect.pas
@@
-2,8
+2,9
@@
unit lcorewsaasyncselect;
\r
interface
\r
\r
\r
interface
\r
\r
+
\r
implementation
\r
implementation
\r
-uses wcore,lcore,bsearchtree,sysutils,windows,winsock,pgtypes,messages,classes;
\r
+uses wcore,lcore,bsearchtree,sysutils,windows,winsock,pgtypes,messages,classes
,lsocket
;
\r
type
\r
twineventcore=class(teventcore)
\r
public
\r
type
\r
twineventcore=class(teventcore)
\r
public
\r
@@
-78,10
+79,10
@@
end;
procedure twineventcore.rmasterset(fd : integer;islistensocket : boolean);
\r
begin
\r
if islistensocket then begin
\r
procedure twineventcore.rmasterset(fd : integer;islistensocket : boolean);
\r
begin
\r
if islistensocket then begin
\r
-
//
writeln('setting accept watch for socket number ',fd);
\r
+
//
writeln('setting accept watch for socket number ',fd);
\r
dowsaasyncselect(fd,FD_ACCEPT or FD_CLOSE,0);
\r
end else begin
\r
dowsaasyncselect(fd,FD_ACCEPT or FD_CLOSE,0);
\r
end else begin
\r
-
//
writeln('setting read watch for socket number',fd);
\r
+
//
writeln('setting read watch for socket number',fd);
\r
dowsaasyncselect(fd,FD_READ or FD_CLOSE,0);
\r
end;
\r
end;
\r
dowsaasyncselect(fd,FD_READ or FD_CLOSE,0);
\r
end;
\r
end;
\r
@@
-116,23
+117,24
@@
var
writetrigger : boolean;
\r
lasio : tlasio;
\r
begin
\r
writetrigger : boolean;
\r
lasio : tlasio;
\r
begin
\r
-
//
writeln('got a message');
\r
+
//
writeln('got a message');
\r
Result := 0; // This means we handled the message
\r
if (ahwnd=hwndlcore) and (aumsg=wm_user) then begin
\r
Result := 0; // This means we handled the message
\r
if (ahwnd=hwndlcore) and (aumsg=wm_user) then begin
\r
-
//
writeln('it appears to be a response to our wsaasyncselect');
\r
+
//
writeln('it appears to be a response to our wsaasyncselect');
\r
socket := awparam;
\r
event := alparam and $FFFF;
\r
error := alparam shr 16;
\r
socket := awparam;
\r
event := alparam and $FFFF;
\r
error := alparam shr 16;
\r
-
//
writeln('socket=',socket,' event=',event,' error=',error);
\r
+
//
writeln('socket=',socket,' event=',event,' error=',error);
\r
readtrigger := false;
\r
writetrigger := false;
\r
lasio := findtree(@fdreverse,inttostr(socket));
\r
if assigned(lasio) then begin
\r
if (error <> 0) or ((event and FD_CLOSE) <> 0) then begin
\r
readtrigger := false;
\r
writetrigger := false;
\r
lasio := findtree(@fdreverse,inttostr(socket));
\r
if assigned(lasio) then begin
\r
if (error <> 0) or ((event and FD_CLOSE) <> 0) then begin
\r
- if lasio.state = wsconnecting then begin
\r
- lasio.onsessionconnected(lasio,error);
\r
+ if (lasio.state = wsconnecting) and (error <> 0) then begin
\r
+ if lasio is tlsocket then tlsocket(lasio).connectionfailedhandler(error)
\r
+ end else begin
\r
+ lasio.internalclose(error);
\r
end;
\r
end;
\r
- lasio.internalclose(error);
\r
end else begin
\r
if (event and (FD_READ or FD_ACCEPT)) <> 0 then readtrigger := true;
\r
if (event and (FD_WRITE)) <> 0 then writetrigger := true;
\r
end else begin
\r
if (event and (FD_READ or FD_ACCEPT)) <> 0 then readtrigger := true;
\r
if (event and (FD_WRITE)) <> 0 then writetrigger := true;
\r
@@
-195,7
+197,7
@@
var
\r
begin
\r
eventcore := twineventcore.create;
\r
\r
begin
\r
eventcore := twineventcore.create;
\r
-
if Windows.RegisterClass(MyWindowClass) = 0 then halt;
\r
+ if Windows.RegisterClass(MyWindowClass) = 0 then halt;
\r
//writeln('about to create lcore handle, hinstance=',hinstance);
\r
hwndlcore := CreateWindowEx(WS_EX_TOOLWINDOW,
\r
MyWindowClass.lpszClassName,
\r
//writeln('about to create lcore handle, hinstance=',hinstance);
\r
hwndlcore := CreateWindowEx(WS_EX_TOOLWINDOW,
\r
MyWindowClass.lpszClassName,
\r
@@
-213,4
+215,5
@@
begin
timerwrapperinterface := twintimerwrapperinterface.create(nil);
\r
\r
WSAStartup($200, GInitData);
\r
timerwrapperinterface := twintimerwrapperinterface.create(nil);
\r
\r
WSAStartup($200, GInitData);
\r
+ absoloutemaxs := maxlongint;
\r
end.
\r
end.
\r