5 USES ServerLoop
,Chat
,SysUtils
,MemStream
,NetAddr
,opcode
;
10 procedure ST1(msg
:tSMsg
; data
:boolean);
11 procedure ST2(msg
:tSMsg
; data
:boolean);
12 procedure ST3(msg
:tSMsg
; data
:boolean);
14 procedure HardTimeout
;
17 procedure t
.ST1(msg
:tSMsg
; data
:boolean);
20 write('TestFS: ST1 reply from FS: ');
21 if not data
then begin
23 s
.init(GetMem(56),0,56);
29 end else writeln('unexpected data');
31 procedure t
.ST2(msg
:tSMsg
; data
:boolean);
34 write('TestFS: ST2 reply from FS: ');
36 writeln(msg
.stream
.ReadByte
,'-',msg
.stream
.ReadByte
);
37 s
.init(GetMem(56),0,56);
39 s
.WriteByte(opcode
.upClose
);
42 end else writeln('ack');
44 procedure t
.ST3(msg
:tSMsg
; data
:boolean);
46 write('TestFS: ST3 reply from FS: ');
47 if data
then writeln('unepected data') else begin
49 UnShedule(@HardTimeout
);
50 ch
.DisposeHook
:=@Rekt
;
57 writeln('TestFS: rekt');
58 FreeMem(@self
,sizeof(self
));
61 procedure t
.HardTimeout
;
63 writeln('TestFS: hardtimeout');
64 ch
.DisposeHook
:=@Rekt
;
76 assert(OptParamCount(oi
)=1,opt
+'(rcpt:tNetAddr)');
77 writeln('TestFS: rcpt '+paramstr(oi
+1));
78 new(o
); with o
^ do begin
79 ch
.Init(paramstr(oi
+1));
81 Shedule(7000,@HardTimeout
);
82 s
.init(GetMem(56),0,56);
84 s
.WriteByte(opcode
.upFileServer
);