X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/8dbf997db86622966c80c12998c2b39577de949f..055fa6bf18e0733d1bf2f97075d6bb33c76e72b5:/lcorewsaasyncselect.pas?ds=sidebyside diff --git a/lcorewsaasyncselect.pas b/lcorewsaasyncselect.pas index de9d36f..622c92e 100755 --- a/lcorewsaasyncselect.pas +++ b/lcorewsaasyncselect.pas @@ -2,8 +2,10 @@ unit lcorewsaasyncselect; interface +procedure lcoreinit; implementation + uses wcore,lcore,bsearchtree,sysutils,windows,winsock,pgtypes,messages,classes,lsocket; type twineventcore=class(teventcore) @@ -141,9 +143,9 @@ begin if readtrigger or writetrigger then lasio.handlefdtrigger(readtrigger,writetrigger); end; - // don't reset the event manually for listen sockets to avoid unwanted - // extra onsessionavailible events - if (taddrint(findtree(@fdwatches,inttostr(fd))) and FD_ACCEPT) = 0 dowsaasyncselect(socket,0,0); // if not a listen socket reset watches + // don't reset the event manually for listen sockets to avoid unwanted + // extra onsessionavailible events + if (taddrint(findtree(@fdwatches,inttostr(socket))) and (FD_ACCEPT)) = 0 then dowsaasyncselect(socket,0,0); // if not a listen socket reset watches end; end else if (ahwnd=hwndlcore) and (aumsg=wm_dotasks) then begin //writeln('processing tasks'); @@ -197,7 +199,12 @@ var lpszClassName : 'lcoreClass'); GInitData: TWSAData; +var + inited:boolean; +procedure lcoreinit; begin + if (inited) then exit; + eventcore := twineventcore.create; if Windows.RegisterClass(MyWindowClass) = 0 then halt; //writeln('about to create lcore handle, hinstance=',hinstance); @@ -216,6 +223,11 @@ begin onaddtask := winaddtask; timerwrapperinterface := twintimerwrapperinterface.create(nil); - WSAStartup($200, GInitData); + WSAStartup(2, GInitData); absoloutemaxs := maxlongint; + + + inited := true; +end; + end.