X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/a77cd534c22418ec9a8a22ae42efef1a9500b193..1c8b91ca0f6891a397357c7cf7d77af18c15937d:/lcore.pas diff --git a/lcore.pas b/lcore.pas index 08c242a..ce72179 100644 --- a/lcore.pas +++ b/lcore.pas @@ -40,9 +40,10 @@ interface - be safe for either "ethernet v1" or "PPPoE", both take 8 bytes - IPv6 header: 40 bytes (IPv4 is 20) - TCP/UDP header: 20 bytes + packetbasesize is deprecated and should not be used anymore } packetbasesize = 1432; - receivebufsize=packetbasesize*8; + receivebufsize=16384; var absolutemaxs:integer=0; @@ -110,6 +111,11 @@ interface {$ifdef mswindows} sendflushlasterror:integer; {$endif} + + sendflushmaxwrite:integer; + //how much to write to the socket internally in one go. higher values allow faster throughput especially if latency is high + //but it also causes onsenddata to be called less often (typically once for every sendflushmaxwrite bytes) + function receivestr:tbufferstring; virtual; procedure close; procedure abort; @@ -343,6 +349,7 @@ begin state := wsclosed; fdhandlein := -1; fdhandleout := -1; + sendflushmaxwrite := 16384; end; destructor tlasio.destroy; @@ -490,7 +497,10 @@ begin end; datasentcalled := false; - lensent := sendq.get(data,packetbasesize*2); + lensent := sendflushmaxwrite; + if (lensent <= 0) then lensent := sendq.size; + + lensent := sendq.get(data,lensent); if assigned(data) then result := myfdwrite(fdhandleout,data^,lensent) else result := 0; if result = -1 then lensent := 0 else lensent := result;