X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/4782a5c5afee47721cc617daa40dd29828342c2b..baf753e54d73673524de916757e66ef8c485bc0d:/lcore.pas?ds=sidebyside

diff --git a/lcore.pas b/lcore.pas
index 900bc96..30e9c09 100755
--- a/lcore.pas
+++ b/lcore.pas
@@ -37,6 +37,9 @@ interface
   const
     receivebufsize=1460;
 
+  var
+    absoloutemaxs:integer=0;
+
   type
     {$ifdef ver1_0}
       sigset= array[0..31] of longint;
@@ -326,6 +329,7 @@ end;
 constructor tlasio.create;
 begin
   inherited create(AOwner);
+  if not assigned(eventcore) then raise exception.create('no event core');
   sendq := tfifo.create;
   recvq := tfifo.create;
   state := wsclosed;
@@ -351,8 +355,8 @@ begin
   if nextasin <> nil then begin
     nextasin.prevasin := prevasin;
   end;
-  recvq.destroy;
-  sendq.destroy;
+  recvq.free;
+  sendq.free;
   inherited destroy;
 end;
 
@@ -392,7 +396,7 @@ end;
 
 procedure tlasio.internalclose(error:word);
 begin
-  if state<>wsclosed then begin
+  if (state<>wsclosed) and (state<>wsinvalidstate) then begin
     if (fdhandlein < 0) or (fdhandleout < 0) then raise exception.create('internalclose called with invalid fd handles');
     eventcore.rmasterclr(fdhandlein);//fd_clr(fdhandlein,fdsrmaster);
     eventcore.wmasterclr(fdhandleout);//fd_clr(fdhandleout,fdswmaster);
@@ -419,7 +423,7 @@ begin
 
     if assigned(onsessionclosed) then if not destroying then onsessionclosed(self,error);
   end;
-  sendq.del(maxlongint);
+  if assigned(sendq) then sendq.del(maxlongint);
 end;