/[lcore]/trunk/lcoreselect.pas
ViewVC logotype

Diff of /trunk/lcoreselect.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 61 by plugwash, Thu Feb 4 22:47:07 2010 UTC revision 82 by plugwash, Sat Feb 20 13:48:27 2010 UTC
# Line 93  Line 93 
93    tempsocket    : tlasio  ;    tempsocket    : tlasio  ;
94    socketcount   : integer ; // for debugging perposes :)    socketcount   : integer ; // for debugging perposes :)
95    dw,bt:integer;    dw,bt:integer;
96      fd : integer;
97  begin  begin
98      //writeln('entering processasios');
99  {  inc(lcoretestcount);}  {  inc(lcoretestcount);}
100    
101      //the message loop will exit if all lasio's and ltimer's and lsignal's are destroyed      //the message loop will exit if all lasio's and ltimer's and lsignal's are destroyed
# Line 105  Line 107 
107    for dw := (maxs shr 5) downto 0 do if (fdsr[dw] or fdsw[dw]) <> 0 then begin    for dw := (maxs shr 5) downto 0 do if (fdsr[dw] or fdsw[dw]) <> 0 then begin
108      for bt := 0 to 31 do if (fdsr[dw] or fdsw[dw]) and (1 shl bt) <> 0 then begin      for bt := 0 to 31 do if (fdsr[dw] or fdsw[dw]) and (1 shl bt) <> 0 then begin
109        inc(socketcount);        inc(socketcount);
110        currentsocket := fdreverse[dw shl 5 or bt];        fd := dw shl 5 or bt;
111          //writeln('reversing fd ',fd);
112          currentsocket := fdreverse[fd];
113        {if not assigned(currentsocket) then raise exception.create('currentsocket not assigned');        {if not assigned(currentsocket) then raise exception.create('currentsocket not assigned');
114        if currentsocket.fdhandlein < 0 then raise exception.create('currentsocket.fdhandlein out of range');}        if currentsocket.fdhandlein < 0 then raise exception.create('currentsocket.fdhandlein out of range');}
115        {i've seen the out of range case actually happening, so it can happen. test: just close the fd - beware}        {i've seen the out of range case actually happening, so it can happen. test: just close the fd - beware}
116        if not assigned(currentsocket) then begin        if not assigned(currentsocket) then begin
117          fdclose(dw shl 5 or bt);          fdclose(fd);
118          continue          continue
119        end;        end;
120        if currentsocket.fdhandlein < 0 then begin        if currentsocket.fdhandlein < 0 then begin
121          fdclose(dw shl 5 or bt);          fdclose(fd);
122          continue          continue
123        end;        end;
124        try        try
125          currentsocket.handlefdtrigger(fd_isset(currentsocket.fdhandlein,fdsr),fd_isset(currentsocket.fdhandleout,fdsw));          currentsocket.handlefdtrigger(fd_isset(fd,fdsr),fd_isset(fd,fdsw));
126        except        except
127          on E: exception do begin          on E: exception do begin
128            currentsocket.HandleBackGroundException(e);            currentsocket.HandleBackGroundException(e);
# Line 172  Line 176 
176      end;      end;
177    end; *)    end; *)
178  {  debugout('socketcount='+inttostr(socketcount));}  {  debugout('socketcount='+inttostr(socketcount));}
179      //writeln('leaving processasios');
180  end;  end;
181    
182  procedure tselecteventcore.processmessages;  procedure tselecteventcore.processmessages;
# Line 327  Line 332 
332    
333  procedure tselecteventcore.rmasterset(fd : integer;islistensocket : boolean);  procedure tselecteventcore.rmasterset(fd : integer;islistensocket : boolean);
334  begin  begin
335      //writeln('rmasterset called with fd ',fd);
336    if fd > absoloutemaxs then raise esocketexception.create('file discriptor out of range');    if fd > absoloutemaxs then raise esocketexception.create('file discriptor out of range');
337    if fd > maxs then maxs := fd;    if fd > maxs then maxs := fd;
338    if fd_isset(fd,fdsrmaster) then exit;    if fd_isset(fd,fdsrmaster) then exit;
# Line 336  Line 342 
342    
343  procedure tselecteventcore.rmasterclr(fd: integer);  procedure tselecteventcore.rmasterclr(fd: integer);
344  begin  begin
345      //writeln('rmasterclr called with fd ',fd);
346    if not fd_isset(fd,fdsrmaster) then exit;    if not fd_isset(fd,fdsrmaster) then exit;
347    fd_clr(fd,fdsrmaster);    fd_clr(fd,fdsrmaster);
348    
# Line 344  Line 351 
351    
352  procedure tselecteventcore.wmasterset(fd : integer);  procedure tselecteventcore.wmasterset(fd : integer);
353  begin  begin
354      //writeln('wmasterset called with fd ',fd);
355    if fd > absoloutemaxs then raise esocketexception.create('file discriptor out of range');    if fd > absoloutemaxs then raise esocketexception.create('file discriptor out of range');
356    if fd > maxs then maxs := fd;    if fd > maxs then maxs := fd;
357    
# Line 354  Line 362 
362    
363  procedure tselecteventcore.wmasterclr(fd: integer);  procedure tselecteventcore.wmasterclr(fd: integer);
364  begin  begin
365      //writeln('wmasterclr called with fd ',fd);
366    if not fd_isset(fd,fdswmaster) then exit;    if not fd_isset(fd,fdswmaster) then exit;
367    fd_clr(fd,fdswmaster);    fd_clr(fd,fdswmaster);
368  end;  end;

Legend:
Removed from v.61  
changed lines
  Added in v.82

No admin address has been configured">No admin address has been configured
ViewVC Help
Powered by ViewVC 1.1.22