+ {$ifdef secondlistener}\r
+ if assigned(secondlistener) then if lastsessionfromsecond then begin\r
+ lastsessionfromsecond := false;\r
+ result := secondlistener.receivefrom(data,len,src,srclen);\r
+ exit;\r
+ end;\r
+ {$endif}\r
+ tempsrclen := sizeof(tempsrc);\r
+ result := recvfrom(self.fdhandlein,data^,len,0,srcx,tempsrclen);\r
+\r
+ {$ifdef ipv6}\r
+ biniptemp := inaddrvtobinip(tempsrc);\r
+ if needconverttov4(biniptemp) then begin\r
+ converttov4(biniptemp);\r
+ tempsrclen := makeinaddrv(biniptemp,inttostr(ntohs(tempsrc.InAddr.port)),tempsrc);\r
+ end;\r
+ {$endif}\r
+\r
+ move(tempsrc,src,srclen);\r
+ srclen := tempsrclen;\r
+end;\r
+\r
+procedure tlsocket.taskcallconnectionfailedhandler(wparam,lparam : longint);\r
+begin\r
+ connectionfailedhandler(wparam);\r
+end;\r
+\r
+procedure tlsocket.connectionfailedhandler(error:word);\r
+begin\r
+ if trymoreips then begin\r
+// writeln('failed with error ',error);\r
+ connecttimeout.enabled := false;\r
+ destroying := true;\r
+ state := wsconnected;\r
+ self.internalclose(0);\r
+ destroying := false;\r
+ realconnect;\r
+ end else begin\r
+ state := wsconnected;\r
+ if assigned(onsessionconnected) then onsessionconnected(self,error);\r
+ self.internalclose(0);\r
+ recvq.del(maxlongint);\r
+ end;\r
+end;\r
+\r
+procedure tlsocket.connectsuccesshandler;\r
+begin\r
+ trymoreips := false;\r
+ connecttimeout.enabled := false;\r
+ if assigned(onsessionconnected) then onsessionconnected(self,0);\r