Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DmBel committed Mar 6, 2024
1 parent 992705f commit e92fd44
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 123 deletions.
31 changes: 15 additions & 16 deletions blcksock.pas
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ TBlockSocket = class(TObject)
FNonBlockMode: Boolean;
FMaxLineLength: Integer;
FMaxSendBandwidth: Integer;
FNextSend: UInt32;
FNextSend: FixedUInt;
FMaxRecvBandwidth: Integer;
FNextRecv: UInt32;
FNextRecv: FixedUInt;
FConvertLineEnd: Boolean;
FLastCR: Boolean;
FLastLF: Boolean;
Expand Down Expand Up @@ -377,7 +377,7 @@ TBlockSocket = class(TObject)
procedure DoMonitor(Writing: Boolean; const Buffer: TMemory; Len: Integer);
procedure DoCreateSocket;
procedure DoHeartbeat;
procedure LimitBandwidth(Length: Integer; MaxB: integer; var Next: UInt32);
procedure LimitBandwidth(Length: Integer; MaxB: integer; var Next: FixedUInt);
procedure SetBandwidth(Value: Integer);
function TestStopFlag: Boolean;
procedure InternalSendStream(const Stream: TStream; WithSize, Indy: boolean); virtual;
Expand Down Expand Up @@ -1509,9 +1509,9 @@ TIPHeader = record
TTL: Byte;
Protocol: Byte;
CheckSum: Word;
SourceIp: UInt32;
DestIp: UInt32;
Options: UInt32;
SourceIp: FixedUInt;
DestIp: FixedUInt;
Options: FixedUInt;
end;

{:@abstract(Parent class of application protocol implementations.)
Expand Down Expand Up @@ -1858,8 +1858,7 @@ procedure TBlockSocket.DelayedOption(const Value: TSynaOption);
begin
if FSocket = INVALID_SOCKET then
begin
SetLength(FDelayedOptions, Length(FDelayedOptions) + 1);
FDelayedOptions[High(FDelayedOptions)] := Value;
FDelayedOptions := FDelayedOptions + [Value];
end
else
SetDelayedOption(Value);
Expand Down Expand Up @@ -2113,10 +2112,10 @@ procedure TBlockSocket.SetBandwidth(Value: Integer);
MaxRecvBandwidth := Value;
end;

procedure TBlockSocket.LimitBandwidth(Length: Integer; MaxB: integer; var Next: UInt32);
procedure TBlockSocket.LimitBandwidth(Length: Integer; MaxB: integer; var Next: FixedUInt);
var
x: UInt32;
y: UInt32;
x: FixedUInt;
y: FixedUInt;
n: integer;
begin
if FStopFlag then
Expand Down Expand Up @@ -2356,7 +2355,7 @@ function TBlockSocket.RecvBufferEx(Buffer: TMemory; Len: Integer;
var
s: TSynaBytes;
rl, l: integer;
ti: UInt32;
ti: FixedUInt;
{$IFDEF CIL}
n: integer;
b: TMemory;
Expand Down Expand Up @@ -2444,7 +2443,7 @@ function TBlockSocket.RecvPacket(Timeout: Integer): TSynaBytes;
begin
{$IFDEF MSWINDOWS}
//not drain CPU on large downloads...
Sleep(0);
Sleep(10{0});
{$ENDIF}
x := WaitingData;
if x > 0 then
Expand Down Expand Up @@ -2529,7 +2528,7 @@ function TBlockSocket.RecvTerminated(Timeout: Integer; const Terminator: string)
CorCRLF: Boolean;
t: string;
tl: integer;
ti: UInt32;
ti: FixedUInt;
begin
ResetLastError;
Result := '';
Expand Down Expand Up @@ -3507,7 +3506,7 @@ function TSocksBlockSocket.SocksOpen: boolean;
;
2:
begin
buf := #1 + Char(Length(FSocksUsername)) + FSocksUsername +
Buf := #1 + Char(Length(FSocksUsername)) + FSocksUsername +
Char(Length(FSocksPassword)) + FSocksPassword;
SendString(Buf);
Buf := RecvBufferStr(2, FSocksTimeout);
Expand All @@ -3531,7 +3530,7 @@ function TSocksBlockSocket.SocksOpen: boolean;
function TSocksBlockSocket.SocksRequest(Cmd: Byte;
const IP, Port: string): Boolean;
var
buf: string;
Buf: string;
begin
FBypassFlag := True;
try
Expand Down
4 changes: 4 additions & 0 deletions smtpsend.pas
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ function SendToRaw(const MailFrom, MailTo, SMTPHost: string;
Result := False;
SMTP := TSMTPSend.Create;
try
try
// if you need SOCKS5 support, uncomment next lines:
// SMTP.Sock.SocksIP := '127.0.0.1';
// SMTP.Sock.SocksPort := '1080';
Expand Down Expand Up @@ -956,6 +957,9 @@ function SendToRaw(const MailFrom, MailTo, SMTPHost: string;
finally
SMTP.Free;
end;
except
Exit(False);
end;
end;

function SendToEx(const MailFrom, MailTo, Subject, SMTPHost: string;
Expand Down
Loading

0 comments on commit e92fd44

Please sign in to comment.