-
Notifications
You must be signed in to change notification settings - Fork 0
/
jenkins.drawio
1752 lines (1752 loc) · 239 KB
/
jenkins.drawio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" version="24.7.16">
<diagram name="第 1 页" id="0g3aWzYnLtcXMj87QazC">
<mxGraphModel dx="3844" dy="1890" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="qVIc31OxtEuiZdBQp6vo-1" value="Launcher类" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="254" y="-20" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-2" value="remoting" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="124" y="-90" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-3" value="main Thread" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="114" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-4" value="agent" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="1004" y="-80" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-5" value="master" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="994" y="-20" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-6" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="434" y="10" as="sourcePoint" />
<mxPoint x="734" y="10" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-7" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><span style="color:#00627a;">parseJnlpArguments</span></pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="474" y="-80" width="150" height="30" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-8" value="访问http://127.0.0.1:8080/computer/node1/jenkins-agent.jnlp 获取remoting启动参数" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="424" y="-30" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-9" value="Main类<br>createEngine<br>startEngine" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="254" y="90" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-10" value="main Thread" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="114" y="105" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-11" value="Engine类" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="254" y="200" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-12" value="Thread0" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="124" y="220" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-13" value="创建线程池pool,<br>做一些workdir的创建初始化工作" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="384" y="120" width="236" height="30" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-14" value="1.创建IOHub,<br>创建selector,并用pool启动两个线程" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="401" y="200" width="120" height="30" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-15" value="2.创建SSLContext" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="444" y="260" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-17" value="" style="shape=curlyBracket;whiteSpace=wrap;html=1;rounded=1;labelPosition=left;verticalLabelPosition=middle;align=right;verticalAlign=middle;" parent="1" vertex="1">
<mxGeometry x="524" y="200" width="20" height="30" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-23" value="IOHub" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="564" y="180" width="70" height="20" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-24" value="pool-thread0" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="754" y="170" width="120" height="30" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-25" value="pool-thread1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="754" y="223.75" width="120" height="30" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-26" value="IOHub #&nbsp;<span style="background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">IOHubSelectorWatcher</span>" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="550" y="212.5" width="226" height="37.5" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-27" value="" style="endArrow=none;dashed=1;html=1;dashPattern=1 3;strokeWidth=2;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="1049.33" y="700" as="sourcePoint" />
<mxPoint x="1049.33" y="40" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-28" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="364" y="440" as="sourcePoint" />
<mxPoint x="1024" y="440" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-29" value="访问:http://127.0.0.1:8080/tcpSlaveAgentListener/, 获取jenkins的socket端口和公钥,连接协议(JNLP4-connect, ping)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="554" y="400" width="300" height="30" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-30" value="获取endpoint(jenkins主节点)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="384" y="390" width="170" height="40" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-31" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="369" y="550" as="sourcePoint" />
<mxPoint x="5270" y="530" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-32" value="根据endpoint信息用SocketChannel打开到master的socket连接" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="388" y="490" width="350" height="45" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-33" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">5.connectTcp</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="284" y="490" width="90" height="25" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-34" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">4.JnlpEndpointResolver.resolver</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="288" y="370" width="240" height="40" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-35" value="3.创建JnlpProtocolHandler预备用于交互数据的处理(采用的是JNLP4-connect, 实现类是JnlpProtocol4Handler<span style="background-color: initial;">)</span>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="284" y="320" width="436" height="30" as="geometry" />
</mxCell>
<mxCell id="qVIc31OxtEuiZdBQp6vo-36" value="获取端口后还会发起一个到master:port的socket连接请求,以验证端口的有效性,随即断开连接" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="560" y="450" width="314" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-1" value="" style="endArrow=classic;startArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="450" y="880" as="sourcePoint" />
<mxPoint x="940" y="880" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-30" value="Socket" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="S4PnsvHIbKOA204sQYgr-1" vertex="1" connectable="0">
<mxGeometry x="-0.5306" y="1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-2" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">NetworkLayer</pre>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="290" y="850" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-3" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><pre style="font-family: &quot;.AppleSystemUIFont&quot;; font-size: 9.8pt;">AgentProtocolClientFilterLayer</pre></pre></pre>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="70" y="850" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-4" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">ApplicationLayer</pre></pre>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="-660" y="850" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-5" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ProtocolLayer</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-400" y="810" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-6" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ProtocolLayer</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="130" y="810" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-7" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ProtocolLayer</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="320" y="810" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-8" value="" style="shape=curlyBracket;whiteSpace=wrap;html=1;rounded=1;labelPosition=left;verticalLabelPosition=middle;align=right;verticalAlign=middle;rotation=90;" parent="1" vertex="1">
<mxGeometry x="-149.37" y="330.63" width="43.13" height="916.25" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-9" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ProtocolStack</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="63" y="720" width="117" height="50" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-10" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">AckFilterLayer</pre></pre>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="-70" y="850" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-11" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ProtocolLayer</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-630" y="811" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-39" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="360" y="920" as="targetPoint" />
<mxPoint x="360" y="1050" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-17" value="IOHub" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="500" y="880" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-18" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ReadableByteChannel</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="510" y="810.5" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-19" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">WritableByteChannel</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="510" y="840.5" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-20" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">InputStream</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="670" y="810.5" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-21" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">SocketChannel</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="790" y="810.5" width="120" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-23" value="包装" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="600" y="840.5" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-24" value="包装" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="750" y="840.5" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-25" value="包装" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="600" y="810.5" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-26" value="包装" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="740" y="810.5" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-27" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">OutputStream</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="650" y="840.5" width="110" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-28" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">SocketChannel</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="790" y="840.5" width="120" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-31" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">BIONetworkLayer:</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="450" y="781" width="150" height="29" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-32" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">NIONetworkLayer:</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="450" y="920" width="150" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-33" value="in:" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="414" y="810" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-34" value="out:" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="414" y="841" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-35" value="in:" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="410" y="950" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-36" value="out" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="407" y="980" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-37" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">SocketChannel</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="467" y="950" width="126" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-38" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">SocketChannel</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="470" y="980" width="126" height="30" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-44" value="<pre style="border-color: var(--border-color); font-weight: 400; background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">Ptr recvHead</pre>" style="swimlane;fontStyle=1;align=center;verticalAlign=middle;childLayout=stackLayout;horizontal=1;startSize=29;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="294" y="1060" width="210" height="80" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-46" value="<font style="font-size: 12px;"><font face="JetBrains Mono, monospace" color="#080808"><span style="background-color: rgb(255, 255, 255);">layer = networklayer<br></span></font>nextSend = null<br>nextRecv =<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;" parent="S4PnsvHIbKOA204sQYgr-44" vertex="1">
<mxGeometry y="29" width="210" height="51" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-66" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="S4PnsvHIbKOA204sQYgr-47" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="395" y="1150" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-47" value="<pre style="border-color: var(--border-color); font-weight: 400; background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">Ptr sendHead</pre>" style="swimlane;fontStyle=1;align=center;verticalAlign=middle;childLayout=stackLayout;horizontal=1;startSize=29;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="290" y="1210" width="210" height="80" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-48" value="<font style="font-size: 12px;">sendHead初始化为recvhead, 如果没有FilterLayer设置,那就和recvhead一样的值<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;" parent="S4PnsvHIbKOA204sQYgr-47" vertex="1">
<mxGeometry y="29" width="210" height="51" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-54" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" parent="1" source="S4PnsvHIbKOA204sQYgr-49" target="S4PnsvHIbKOA204sQYgr-3" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="210" y="930" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-49" value="<pre style="border-color: var(--border-color); font-weight: 400; background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">Ptr</pre>" style="swimlane;fontStyle=1;align=center;verticalAlign=middle;childLayout=stackLayout;horizontal=1;startSize=29;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="60" y="1060" width="210" height="80" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-50" value="<font style=""><font style="" face="JetBrains Mono, monospace" color="#080808"><span style="background-color: rgb(255, 255, 255);">layer = FilterLayer1<br></span></font>nextSend =&nbsp;<br>nextRecv =<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;" parent="S4PnsvHIbKOA204sQYgr-49" vertex="1">
<mxGeometry y="29" width="210" height="51" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-51" value="" style="endArrow=classic;html=1;rounded=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="S4PnsvHIbKOA204sQYgr-49" target="S4PnsvHIbKOA204sQYgr-46" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="75" y="54" as="sourcePoint" />
<mxPoint x="125" y="54" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-59" value="" style="endArrow=classic;html=1;rounded=0;" parent="S4PnsvHIbKOA204sQYgr-49" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="10" y="70" as="sourcePoint" />
<mxPoint x="-20" y="70" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-53" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="300" y="1130" as="sourcePoint" />
<mxPoint x="270" y="1130" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-58" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" parent="1" source="S4PnsvHIbKOA204sQYgr-55" target="S4PnsvHIbKOA204sQYgr-10" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-55" value="<pre style="border-color: var(--border-color); font-weight: 400; background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">Ptr SendHead</pre>" style="swimlane;fontStyle=1;align=center;verticalAlign=middle;childLayout=stackLayout;horizontal=1;startSize=29;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-170" y="1060" width="210" height="80" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-56" value="<font style=""><font style="" face="JetBrains Mono, monospace" color="#080808"><span style="background-color: rgb(255, 255, 255);">layer = FilterLayer2<br></span></font>nextSend =&nbsp;<br>nextRecv =<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;" parent="S4PnsvHIbKOA204sQYgr-55" vertex="1">
<mxGeometry y="29" width="210" height="51" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-57" value="" style="endArrow=classic;html=1;rounded=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="S4PnsvHIbKOA204sQYgr-55" target="S4PnsvHIbKOA204sQYgr-50" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="75" y="54" as="sourcePoint" />
<mxPoint x="125" y="54" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-64" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="S4PnsvHIbKOA204sQYgr-60" target="S4PnsvHIbKOA204sQYgr-4" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-295" y="1000" />
<mxPoint x="-600" y="1000" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-60" value="<pre style="border-color: var(--border-color); font-weight: 400; background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">Ptr </pre>" style="swimlane;fontStyle=1;align=center;verticalAlign=middle;childLayout=stackLayout;horizontal=1;startSize=29;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-400" y="1060" width="210" height="80" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-61" value="<font style=""><font style="" face="JetBrains Mono, monospace" color="#080808"><span style="background-color: rgb(255, 255, 255);">layer = ApplicationLayer<br></span></font>nextSend =&nbsp;<br>nextRecv = null<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;" parent="S4PnsvHIbKOA204sQYgr-60" vertex="1">
<mxGeometry y="29" width="210" height="51" as="geometry" />
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-62" value="" style="endArrow=classic;html=1;rounded=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="S4PnsvHIbKOA204sQYgr-60" target="S4PnsvHIbKOA204sQYgr-56" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="75" y="54" as="sourcePoint" />
<mxPoint x="125" y="54" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="S4PnsvHIbKOA204sQYgr-65" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="-160" y="1130" as="sourcePoint" />
<mxPoint x="-190" y="1130" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="LlYnxhrn1TKEqOn0lMnf-1" value="<font color="#6666ff">while(IOHub.isOpen()<span style="background-color: initial;">)轮询selector, 如果有事件,取出IOHubReadyListener线程对象,</span><span style="background-color: initial;">用线程池pool去运行</span></font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="864" y="175" width="150" height="30" as="geometry" />
</mxCell>
<mxCell id="LlYnxhrn1TKEqOn0lMnf-2" value="<font color="#6666ff">只是起到selector wakeup的作用</font>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="854" y="240" width="130" height="30" as="geometry" />
</mxCell>
<mxCell id="FhYZfcETigPhw3zmsrr1-1" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">SSLEngineFilterLayer</pre></pre>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="-250" y="850" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="FhYZfcETigPhw3zmsrr1-2" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">ConnectionHeadersFilterLayer</pre></pre>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="-490" y="850" width="230" height="60" as="geometry" />
</mxCell>
<mxCell id="FhYZfcETigPhw3zmsrr1-3" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;.AppleSystemUIFont&quot;; font-size: 9.8pt;">BIONetworkLayer</pre></pre>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="-105" y="1460" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="FhYZfcETigPhw3zmsrr1-4" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="60" y="1500" as="sourcePoint" />
<mxPoint x="150" y="1500" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="FhYZfcETigPhw3zmsrr1-6" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">getIoHub().execute(reader)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="170" y="1475" width="210" height="45" as="geometry" />
</mxCell>
<mxCell id="FhYZfcETigPhw3zmsrr1-7" value="新线程读数据" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="160" y="1500" width="110" height="30" as="geometry" />
</mxCell>
<mxCell id="FhYZfcETigPhw3zmsrr1-8" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="404" y="1497" as="sourcePoint" />
<mxPoint x="464" y="1497" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="FhYZfcETigPhw3zmsrr1-9" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">等待启动完成ProtocolStack.<span style="color:#00627a;font-style:italic;">waitForStart</span>()</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="480" y="1483" width="270" height="37" as="geometry" />
</mxCell>
<mxCell id="FhYZfcETigPhw3zmsrr1-10" value="<pre style="background-color:#ffffff;color:#080808;font-family:'.AppleSystemUIFont';font-size:9.8pt;">AgentProtocolClientFilterLayer</pre>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="-170" y="1650" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="FhYZfcETigPhw3zmsrr1-11" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="65" y="1690" as="sourcePoint" />
<mxPoint x="155" y="1690" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="FhYZfcETigPhw3zmsrr1-13" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">getIoHub().execute(writer)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="170" y="1520" width="210" height="45" as="geometry" />
</mxCell>
<mxCell id="FhYZfcETigPhw3zmsrr1-16" value="<pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">创建一个writequeue: ByteBufferQueue包含new ByteBuffer[<font style="font-size: 9.8pt;" color="#871094"><i>16</i></font><font style="font-size: 9.8pt;" color="#080808">], 每个8192字节,</font></pre><pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><font style="font-size: 9.8pt;" color="#080808">client发送的内容都会写到这个writequeue来发送;</font></pre><pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">创建一个recvqueue ByteBufferQueue用来写入接收的数据;</pre><pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">创建一个sendqueue:ByteBufferQueue也是用于发送数据(最终还是写入writequeue来发送);</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="150" y="1370" width="698" height="90" as="geometry" />
</mxCell>
<mxCell id="FhYZfcETigPhw3zmsrr1-17" value="<pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">创建一个sendqueue:ByteBufferQueue包含new ByteBuffer[<font style="font-size: 9.8pt;" color="#871094"><i>16</i></font><font style="font-size: 9.8pt;" color="#080808">], </font>每个8192字节,用于发送数据, </pre><pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">经由此层发送的数据,附加到sendqueue中进行发送;</pre><pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">启动开始发送"Protocol:JNLP4-connect"<span style="color: rgb(8, 8, 8); font-size: 9.8pt;">;-- 24字节==2字节长度+22字节串</span></pre><font face="JetBrains Mono, monospace" color="#080808"></font><pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><font style="font-size: 9.8pt;" color="#080808">接收的数据不处理,直接交给下一层,所以没有recv queue相关属性</font></pre>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="185" y="1630" width="740" height="90" as="geometry" />
</mxCell>
<mxCell id="tP1lmiw2_yDiyHUFnw0z-1" value="<pre style="background-color:#ffffff;color:#080808;font-family:'.AppleSystemUIFont';font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">AckFilterLayer</pre></pre>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="-185" y="1850" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="tP1lmiw2_yDiyHUFnw0z-2" value="<pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">创建一个sendqueue:ByteBufferQueue包含new ByteBuffer[<font style="font-size: 9.8pt;" color="#871094"><i>16</i></font><font style="font-size: 9.8pt;" color="#080808">], </font></pre><pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><font style="font-size: 9.8pt;" color="#080808">每个8192字节,用于发送数据, 经由此层发送的数据,附加到sendqueue中进行发送;</font></pre><pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><pre style="border-color: var(--border-color); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">启动开始发送"ACK";-- 5字节==2字节长度+3字节字符串</pre></pre><pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">创建一个recvqueue:ByteBufferQueue<font style="font-size: 9.8pt;" color="#080808">接收的数据附加到这个queue中</font></pre>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="130" y="1820" width="569" height="90" as="geometry" />
</mxCell>
<mxCell id="tP1lmiw2_yDiyHUFnw0z-3" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="30" y="1879" as="sourcePoint" />
<mxPoint x="120" y="1879" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="tP1lmiw2_yDiyHUFnw0z-4" value="<pre style="background-color:#ffffff;color:#080808;font-family:'.AppleSystemUIFont';font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">SSLEngineFilterLayer</pre></pre>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="-190" y="1990" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="tP1lmiw2_yDiyHUFnw0z-5" value="<pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><pre style="color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">执行握手sslEngine.beginHandshake();</pre></pre><pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><span style="color: rgb(8, 8, 8);">创建ConcurrentLinkedQueue&lt;<span style="color:#000000;">ByteBuffer&gt; messages 保存发送的信息;</span></span></pre><pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">发送时会从message拿出信息,调用sslEngine.wrap()封装信息放到ByteBuffer对象里,再发送;</pre><pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">收到信息时会先accumulate在“ByteBuffer previous”,再判断是不是handshake信息,再用sslEngine.unwrap()解封装;</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="155" y="1960" width="570" height="110" as="geometry" />
</mxCell>
<mxCell id="tP1lmiw2_yDiyHUFnw0z-6" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="30" y="2019.5" as="sourcePoint" />
<mxPoint x="120" y="2019.5" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="tP1lmiw2_yDiyHUFnw0z-7" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ConnectionHeadersFilterLayer</pre>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="-272.8" y="2120" width="290" height="60" as="geometry" />
</mxCell>
<mxCell id="tP1lmiw2_yDiyHUFnw0z-8" value="<pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">创建一个sendqueue:ByteBufferQueue包含new ByteBuffer[<font style="font-size: 9.8pt;" color="#871094"><i>16</i></font><font style="font-size: 9.8pt;" color="#080808">], </font></pre><pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><font style="font-size: 9.8pt;" color="#080808">每个8192字节,用于发送数据, 经由此层发送的数据,附加到sendqueue中进行发送;</font></pre><pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">创建一个recvqueue:ByteBufferQueue<font style="font-size: 9.8pt;" color="#080808">接收的数据附加到这个queue中</font></pre>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="182.5" y="2090" width="569" height="90" as="geometry" />
</mxCell>
<mxCell id="tP1lmiw2_yDiyHUFnw0z-9" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="40" y="2150" as="sourcePoint" />
<mxPoint x="130" y="2150" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="tP1lmiw2_yDiyHUFnw0z-10" value="问题: 在发送和接收数据时,如何保证当前信息是完整的?而不是被分割放到前一条或下一条信息里?" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-550" y="1960" width="290" height="80" as="geometry" />
</mxCell>
<mxCell id="tP1lmiw2_yDiyHUFnw0z-12" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ProtocolStack</pre>" style="rounded=1;whiteSpace=wrap;html=1;dashed=1;" parent="1" vertex="1">
<mxGeometry x="-240" y="2320" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="tP1lmiw2_yDiyHUFnw0z-13" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="-60" y="2360" as="sourcePoint" />
<mxPoint x="160" y="2360" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="tP1lmiw2_yDiyHUFnw0z-14" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><span style="color:#000000;">ProtocolStack.init()结束时才调用</span>awaitStart.countDown(), 此后NetworkLayer才从通道读取返回的数据进行处理</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="60" y="2308" width="460" height="42" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-1" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">ConnectionHeadersFilterLayer</pre></pre>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="-690" y="2610" width="230" height="60" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-2" value="发送数据时,数据的转换过程:" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-710" y="2530" width="220" height="30" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-3" value="doSend(ByteBuffer data)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-650" y="2760" width="150" height="30" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-5" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="-590.5" y="2680" as="sourcePoint" />
<mxPoint x="-590" y="2730" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-7" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="-590" y="2800" as="sourcePoint" />
<mxPoint x="-589.5" y="2850" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-8" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">当没finished或者</pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">原先有数据时,先存储</pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">sendQueue.put(data)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-640" y="2853" width="130" height="70" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-9" value="sendQueue是一个ByteBuffer[]数组数据类型,每个数组元素ByteBuffer大小定义成8192,sendQueue会保存data参数数据(存储在sendQueue中是连续的,无边界,所以如果往里写的data数据比较大的话,sendQueue会动态申请更多ByteBuffer数组元素去保存,所以data的存储是会跨数组元素存储的)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-1020" y="2833" width="370" height="90" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-10" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="-590" y="2950" as="sourcePoint" />
<mxPoint x="-589" y="3050" as="targetPoint" />
<Array as="points">
<mxPoint x="-590" y="2960" />
<mxPoint x="-589" y="2960" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-11" value="然后循环发送<br><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">ByteBuffer tmp = ByteBuffer.<span style="font-style:italic;">allocate</span>(<span style="color:#871094;">8192</span>); //申请一个8192的ByteBuffer tmp</pre></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">while (sendQueue.hasRemaining()) {</pre><pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><pre style="color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"> ((Buffer) <span style="color:#000000;">tmp</span>).clear();</pre><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><font color="#080808"> sendQueue.get(tmp); //</font><b style=""><font color="#ff6666">填满tmp 8192字节</font></b><font color="#080808">,或者不满8192但是sendQueue已经读取完毕</font></pre><pre style="color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"> ptr.doSend(<span style="color:#000000;">tmp</span>); //发送</pre></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">}</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-690" y="3060" width="610" height="220" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-12" value="doSend()是上层应用层调用,我们无法预知data的大小,所以借助sendQueue这一动态空间先保存" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-890" y="2760" width="200" height="50" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-14" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">getNextSend().layer.doSend(tmp)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-700" y="3300" width="280" height="40" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-15" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="-575.5" y="3240" as="sourcePoint" />
<mxPoint x="-575" y="3290" as="targetPoint" />
<Array as="points">
<mxPoint x="-575" y="3265" />
<mxPoint x="-575" y="3265" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-16" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><pre style="border-color: var(--border-color); font-size: 9.8pt; font-family: &quot;JetBrains Mono&quot;, monospace;">SSLEngineFilterLayer</pre></pre></pre>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="205" y="2600" width="230" height="60" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-17" value="doSend(ByteBuffer&nbsp;message<span style="background-color: initial;">)</span>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="234" y="2710" width="176" height="30" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-19" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="-570" y="2800" as="sourcePoint" />
<mxPoint x="-390" y="2890" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-20" value="注意,这里有分叉,当sendQueue原先没数据时,<br>直接调用<span style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><font color="#080808">ptr.doSend(data), </font><b style=""><font color="#ff6666">data大小未知</font></b></span>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-500" y="2872" width="300" height="70" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-21" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">getNextSend().layer.doSend(data)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-510" y="2970" width="280" height="40" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-22" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="-390" y="2930" as="sourcePoint" />
<mxPoint x="-389.5" y="2980" as="targetPoint" />
<Array as="points">
<mxPoint x="-389.5" y="2940" />
<mxPoint x="-389.5" y="2940" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-24" value="这个ByteBuffer <b><font color="#ff6666">message的大小也是未知的</font></b>,因为tmp的值可能是上一层直接发送的data或上一层self_data, 也有可能是通过ByfeBufferQueue获取的8192字节的tmp; 也有可能是自身的self_data" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="430" y="2700" width="406" height="60" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-25" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="-390" y="2800" as="sourcePoint" />
<mxPoint x="-120" y="2870" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-26" value="注意,这里有分叉,这层有自身的数据要发送,<br>直接调用<span style="background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">ptr.doSend(self_data)</span>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-210" y="2867" width="300" height="70" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-27" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">getNextSend().layer.doSend(self_data)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-210" y="2970" width="310" height="40" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-28" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="-120" y="2930" as="sourcePoint" />
<mxPoint x="-119.5" y="2980" as="targetPoint" />
<Array as="points">
<mxPoint x="-119.5" y="2940" />
<mxPoint x="-119.5" y="2940" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-29" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ByteBuffer newBuffer = <span style="color:#000000;">ByteBuffer</span>.<span style="font-style:italic;">allocate</span>(message.remaining() * <span style="color:#1750eb;">2</span>)</pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="text-align: left; font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">newBuffer.put(message)</pre><pre style="text-align: left; font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">messages.add(newBuffer). //先存储到ConcurrentLinkedQueue中,FIFO<br></pre></pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="167" y="2780" width="540" height="87" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-30" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="338.5" y="2740" as="sourcePoint" />
<mxPoint x="338.5" y="2790" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-31" value="分配一个2倍空间存储, 为什么??" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="715" y="2780" width="210" height="30" as="geometry" />
</mxCell>
<mxCell id="62yxdlusjtpypa1GuYyr-32" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">if (<span style="color:#000000;">State</span>.<span style="color:#871094;font-style:italic;">CREDENTAILS_AVAILABLE</span>.equals(<span style="color:#871094;">state</span>)) { //当不在状态时,不发,这也是存储的原因之一</pre></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"> while (<span style="color:#0033b3;">null </span>!= (<span style="color:#000000;">request </span>= <span style="color:#871094;">messages</span>.poll())) { // 一发就从queue中逐条发送完</pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><span style=""><span style="white-space: pre;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span>processWrite(<span style="font-size: 9.8pt; color: rgb(0, 0, 0);">ByteBuffer </span><span style="font-size: 9.8pt;">request)</span><br></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"> }</pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">}</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="170" y="2872" width="660" height="102" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-1" value="<b><font color="#ff6666">所以上一层的ByteBuffer到这一层开头就不再引用,数据已经存储到新ByteBuffer中</font></b>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="707" y="2810" width="275" height="30" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-2" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><div style="text-align: left;"><span style="font-size: 9.8pt; white-space: normal;">final int </span><span style="font-size: 9.8pt; white-space: normal; color: rgb(0, 0, 0);">packetBufferSize </span><span style="font-size: 9.8pt; white-space: normal;">= </span><span style="font-size: 9.8pt; white-space: normal; color: rgb(0, 0, 0);">sslEngine</span><span style="font-size: 9.8pt; white-space: normal;">.getSession().getPacketBufferSize();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// 16709</span></div><span style="color:#0033b3;">final int </span><span style="color:#000000;">applicationBufferSize </span>= <span style="color:#000000;">sslEngine</span>.getSession().getApplicationBufferSize(); //16704</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="430" y="2605" width="798" height="50" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-3" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="321.5" y="2965" as="sourcePoint" />
<mxPoint x="321.5" y="3015" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-4" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ByteBuffer appBuffer = <span style="color:#000000;">ByteBuffer</span>.<span style="font-style:italic;">allocate</span>(<span style="color:#871094;">sslEngine</span>.getSession().getPacketBufferSize());</pre><pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><font color="#080808">SSLEngineResult result = </font><span style="color: rgb(135, 16, 148); font-size: 9.8pt;">sslEngine</span><span style="color: rgb(8, 8, 8); font-size: 9.8pt;">.wrap(request, </span><span style="color: rgb(0, 0, 0); font-size: 9.8pt;">appBuffer</span><font color="#080808">); // </font><b style=""><font color="#ff6666">request的大小未知</font></b><font color="#080808">,有可能在过appBuffer, </font></pre><pre style="background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"> 此时在BUFFER_OVERFLOW中要重新分配appBuffer的大小</pre><pre style="background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">while (<span style="color:#000000;">appBuffer</span>.hasRemaining()) { //需要循环说明啥? ??<br> next().doSend(<span style="color:#000000;">appBuffer</span>);<br>}</pre></pre>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="80" y="3010" width="830" height="150" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-5" value="<pre style="border-color: var(--border-color); color: rgb(8, 8, 8); font-size: 9.8pt; font-family: &quot;JetBrains Mono&quot;, monospace;">AckFilterLayer</pre>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="2340" y="2570" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-6" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">getNextSend().layer.doSend(appBuffer)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="114" y="3240" width="280" height="40" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-7" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="234" y="3130" as="sourcePoint" />
<mxPoint x="235" y="3230" as="targetPoint" />
<Array as="points">
<mxPoint x="234.5" y="3155" />
<mxPoint x="234.5" y="3155" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-8" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="321.5" y="2660" as="sourcePoint" />
<mxPoint x="321.5" y="2710" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-9" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="320" y="2670" as="sourcePoint" />
<mxPoint x="1140" y="2710" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-10" value="握手过程中,也可以直接发握手数据" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="1051" y="2715" width="190" height="30" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-11" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ByteBuffer appBuffer = <span style="color:#000000;">ByteBuffer</span>.<span style="font-style:italic;">allocate</span>(<span style="color:#871094;">sslEngine</span>.getSession().getPacketBufferSize());</pre><pre style="background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">SSLEngineResult result = <span style="font-size: 9.8pt; color: rgb(135, 16, 148);">sslEngine</span>.wrap(EMPTY_BUFFER, <span style="font-size: 9.8pt; color: rgb(0, 0, 0);">appBuffer</span>); // EMPTY_BUFFER的大小为0,但是是握手,有可能在要发送的超过appBuffer,&nbsp;<br></pre><pre style="background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"> 此时在BUFFER_OVERFLOW中要重新分配appBuffer的大小</pre><pre style="background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><br>next().doSend(<span style="color:#000000;">appBuffer</span>);<br><br></pre></pre>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="1020" y="2813" width="830" height="150" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-12" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="1145.5" y="2760" as="sourcePoint" />
<mxPoint x="1145.5" y="2810" as="targetPoint" />
<Array as="points">
<mxPoint x="1146" y="2755" />
<mxPoint x="1146" y="2755" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-13" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">getNextSend().layer.doSend(appBuffer)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="1000" y="3030" width="280" height="40" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-14" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="1139.5" y="2967.5" as="sourcePoint" />
<mxPoint x="1139.5" y="3017.5" as="targetPoint" />
<Array as="points">
<mxPoint x="1140" y="2962.5" />
<mxPoint x="1140" y="2962.5" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-15" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="2390" y="2650" as="sourcePoint" />
<mxPoint x="2390" y="2710" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-16" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">doSend(<span style="color:#9e880d;">@NonNull </span><span style="color:#000000;">ByteBuffer </span>data)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="2280" y="2720" width="270" height="40" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-17" value="<pre style="border-color: var(--border-color); color: rgb(8, 8, 8); font-size: 9.8pt; text-align: left; font-family: &quot;JetBrains Mono&quot;, monospace;">ConcurrentLinkedQueue保存</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-10" y="2835" width="165" height="37" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-18" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="2320" y="2780" as="sourcePoint" />
<mxPoint x="2320" y="2880" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-19" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="2450" y="2780" as="sourcePoint" />
<mxPoint x="2570" y="2880" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-20" value="当sendQueue有数据时(不止这种条件)先保存到sendQueue中<br><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">sendQueue.put(data);</pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">flushSend(sendQueue);</pre></pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="2190" y="2890" width="210" height="94" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-21" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="2490" y="2770" as="sourcePoint" />
<mxPoint x="2800" y="2875" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-22" value="当sendQueuue没数据时直接发送<br><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">next().doSend(data)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="2490" y="2903" width="180" height="37" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-24" value="<b><font color="#ff6666">data的大小未知</font></b>, 可能会很大,不止8192(上一层的发送就已经未知大小)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="2560" y="2725" width="220" height="25" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-25" value="发送自身数据next().doSend(<font color="#871094">self_data</font><span style="background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">)</span>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="2735" y="2910" width="160" height="30" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-26" value="然后循环发送<br><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">ByteBuffer tmp = ByteBuffer.<span style="font-style:italic;">allocate</span>(<span style="color:#871094;">8192</span>); //申请一个8192的ByteBuffer tmp</pre></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">while (sendQueue.hasRemaining()) {</pre><pre style="background-color: rgb(255, 255, 255); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><pre style="color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"> ((Buffer) <span style="color:#000000;">tmp</span>).clear();</pre><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><font color="#080808"> sendQueue.get(tmp); //</font><b style=""><font color="#ff6666">填满tmp 8192字节</font></b><font color="#080808">,或者不满8192但是sendQueue已经读取完毕</font></pre><pre style="color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"> ptr.doSend(<span style="color:#000000;">tmp</span>); //发送</pre></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">}</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="2060" y="3060" width="610" height="220" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-27" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="2300" y="2980" as="sourcePoint" />
<mxPoint x="2300" y="3080" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-28" value="<pre style="background-color:#ffffff;color:#080808;font-family:'.AppleSystemUIFont';font-size:9.8pt;">AgentProtocolClientFilterLayer</pre>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="3120" y="2560" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-29" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">doSend(<span style="color:#9e880d;">@NonNull </span><span style="color:#000000;">ByteBuffer </span>data)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3085" y="2715" width="270" height="40" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-30" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="3210" y="2640" as="sourcePoint" />
<mxPoint x="3210" y="2690" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-31" value="当sendQueue有数据时(不止这种条件)先保存到sendQueue中<br><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">sendQueue.put(data);</pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">flushSend(sendQueue);</pre></pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3010" y="2831" width="210" height="94" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-32" value="当sendQueuue没数据时直接发送<br><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">next().doSend(data)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3280" y="2840" width="180" height="37" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-33" value="发送自身数据next().doSend(<font color="#871094">self_data</font><span style="background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">)</span>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3510" y="2833" width="160" height="30" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-34" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="3290" y="2770" as="sourcePoint" />
<mxPoint x="3590" y="2820" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-35" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="3270" y="2790" as="sourcePoint" />
<mxPoint x="3370" y="2820" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-36" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="3210" y="2765" as="sourcePoint" />
<mxPoint x="3120" y="2825" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-37" value="<b><font color="#ff6666">data的大小未知</font></b>, 可能会很大,不止8192(上一层的发送就已经未知大小)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3350" y="2705" width="220" height="25" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-38" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">有ByteBufferQueue <span style="color:#871094;">sendQueue</span></pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-690" y="2570" width="230" height="30" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-39" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">有ByteBufferQueue <span style="color:#871094;">sendQueue</span></pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="2270" y="2520" width="230" height="30" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-40" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">有ByteBufferQueue <span style="color:#871094;">sendQueue</span></pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3120" y="2510" width="230" height="30" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-41" value="<pre style="border-color: var(--border-color); color: rgb(8, 8, 8); font-size: 9.8pt; text-align: left; font-family: &quot;JetBrains Mono&quot;, monospace;">有ConcurrentLinkedQueue保存</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="205" y="2550" width="220" height="30" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-42" value="<pre style="background-color:#ffffff;color:#080808;font-family:'.AppleSystemUIFont';font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">BIONetworkLayer</pre></pre>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="3870" y="2555" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-43" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">doSend(<span style="color:#9e880d;">@NonNull </span><span style="color:#000000;">ByteBuffer </span>data)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3840" y="2690" width="270" height="40" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-44" value="<b><font color="#ff6666">data的大小未知</font></b>, 可能会很大,不止8192(上一层的发送就已经未知大小)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="4150" y="2697.5" width="220" height="25" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-45" value="<pre style="text-align: left; background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">ByteBufferQueue send<span style="color:#871094;">Queue(似乎不起作用)</span></pre><div style="text-align: left;"><span style="background-color: initial;">有ByteBufferQueue </span><span style="background-color: initial; font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt; color: rgb(135, 16, 148);">writeQueue, 起作用的是这个</span></div>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3810" y="2470" width="360" height="80" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-46" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">writeQueue.put(data);</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3860" y="2820" width="200" height="20" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-47" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="3974.5" y="2630" as="sourcePoint" />
<mxPoint x="3974.5" y="2680" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-48" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="3969.5" y="2725" as="sourcePoint" />
<mxPoint x="3969.5" y="2765" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-49" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">getIoHub().execute(writer)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3875" y="2773" width="200" height="37" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-50" value="关键的部分,开启一个线程处理writeQueue" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="4150" y="2787" width="170" height="23" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-51" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">IOHub</pre>" style="rounded=1;whiteSpace=wrap;html=1;dashed=1;" parent="1" vertex="1">
<mxGeometry x="4580" y="2540" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-52" value="<pre style="text-align: justify; background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">write.run()</pre></pre>" style="rounded=1;whiteSpace=wrap;html=1;dashed=1;align=left;" parent="1" vertex="1">
<mxGeometry x="3890" y="2910" width="110" height="43" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-53" value="<b>write线程</b>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3790" y="2922" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-54" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;dashed=1;dashPattern=8 8;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="3950" y="2847" as="sourcePoint" />
<mxPoint x="3950" y="2900" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-55" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ByteBuffer data = acquire(); //向IoHub中的bufferPool申请一个limit 8192(capacity实际是16916)的ByteBuffer</pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">while(writeQueue.hasRemaining()){ //循环发送</pre><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span>writeQueue.get(<span style="color:#000000;">data</span>)</pre><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span>((Buffer<span style="font-size: 9.8pt;">) </span><span style="font-size: 9.8pt; color: rgb(0, 0, 0);">data</span><span style="font-size: 9.8pt;">).flip()</span><br></pre><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><span style="font-size: 9.8pt;"><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span><br></span> while (<span style="font-size: 9.8pt; color: rgb(0, 0, 0);">data</span><span style="font-size: 9.8pt;">.remaining() &gt; </span><span style="font-size: 9.8pt; color: rgb(23, 80, 235);">0</span><span style="font-size: 9.8pt;">) {</span></pre><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><span style="font-size: 9.8pt;"> </span>out.write(<span style="font-size: 9.8pt; color: rgb(0, 0, 0);">data</span><span style="font-size: 9.8pt;">); //out是通道,真正向通道发送数据(所以每次发送的数据最大就是8192字节)</span></pre><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><span style="font-size: 9.8pt;"> }</span></pre><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">}</pre></pre>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3860" y="3110" width="680" height="40" as="geometry" />
</mxCell>
<mxCell id="cQ-BIh9Kksjrct9Q46Q1-56" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="3944.5" y="2963" as="sourcePoint" />
<mxPoint x="3944.5" y="3003" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-1" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">ChannelApplicationLayer</pre></pre>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="-1630" y="2605" width="230" height="60" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-2" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="-1580" y="2700" as="sourcePoint" />
<mxPoint x="-1580" y="2740" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-3" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">write(<span style="color:#000000;">ByteBuffer </span>header, <span style="color:#000000;">ByteBuffer </span>data)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-1850" y="2745" width="390" height="55" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-4" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="-1440" y="2682.5" as="sourcePoint" />
<mxPoint x="-1260" y="2760" as="targetPoint" />
<Array as="points">
<mxPoint x="-1440" y="2730" />
<mxPoint x="-1260" y="2730" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-5" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">write(self_data)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-1380" y="2768" width="230" height="32" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-6" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="-1630" y="2813" as="sourcePoint" />
<mxPoint x="-1630" y="2893" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-7" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">ptr.doSend(header)</pre></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ptr.doSend(data)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-1740" y="2913.5" width="230" height="47" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-8" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ptr.doSend(self_data)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-1340" y="2900" width="190" height="74" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-9" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="-1260" y="2818.5" as="sourcePoint" />
<mxPoint x="-1260" y="2898.5" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-10" value="发送自身数据(84字节),发送的是Capability对象" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-1340" y="2660" width="150" height="30" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-11" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">rO0ABXNyABpodWRzb24ucmVtb3RpbmcuQ2FwYWJpbGl0eQAAAAAAAAABAgABSgAEbWFza3hwAAAAAAAAAf4</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-1380" y="2685" width="640" height="25" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-13" value="发送自身数据self_data: BYE<br>及首部字段(101 byte):<br>&nbsp;{"Node-Name":"node1","Secret-Key":"1ace6c05372c72d6a7226258e7f959354fea9afa00bb0a93d631678c5f1a5170"}" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-510" y="2720" width="705" height="29" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-14" value="self_data:&nbsp; ACK" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="2735" y="2955" width="145" height="25" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-15" value="self_data(22 byte):&nbsp; "Protocol:JNLP4-connect"" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3510" y="2877" width="260" height="33" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-18" value="" style="shape=link;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="100" relative="1" as="geometry">
<mxPoint x="-2060" y="3360" as="sourcePoint" />
<mxPoint x="4970.34" y="3373" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-19" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">ByteBuffer buffer = acquire(); //向IoHub中的bufferPool申请一个limit 8192(capacity实际是16916)的ByteBuffer</pre></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">while (<span style="color:#871094;">in</span>.isOpen()){ //循环读取</pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span>in.read(<span style="font-size: 9.8pt; color: rgb(0, 0, 0);">buffer</span><span style="font-size: 9.8pt;">)</span><br></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><span style="font-size: 9.8pt;"> </span>((Buffer<span style="font-size: 9.8pt;">) </span><span style="font-size: 9.8pt; color: rgb(0, 0, 0);">buffer</span><span style="font-size: 9.8pt;">).flip();</span></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><span style="font-size: 9.8pt;"> </span>while (<span style="font-size: 9.8pt; color: rgb(0, 0, 0);">buffer</span><span style="font-size: 9.8pt;">.hasRemaining()) {</span></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"> onRead(<span style="color:#000000;">buffer</span>);<br> <br> }</pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">}</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3890" y="3480" width="830" height="70" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-20" value="<b>read线程</b>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3760" y="3430" width="80" height="20" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-23" value="所有发送数据放入writeQueue中排队,而不是直接发送" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="4135" y="2823" width="230" height="30" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-24" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="4190" y="3660" as="sourcePoint" />
<mxPoint x="4190" y="3730" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-25" value="recvQueue有数据则放入recvQueue中排队" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="4135" y="3730" width="245" height="30" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-26" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="3920" y="3650" as="sourcePoint" />
<mxPoint x="3920" y="3740" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-27" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">flushRecvQueue()</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="4110" y="3790" width="200" height="30" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-28" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="4190" y="3820" as="sourcePoint" />
<mxPoint x="4190" y="3890" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-29" value="recvQueue中没有数据则直接处理<br><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ptr.onRecv(data)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3820" y="3760" width="200" height="40" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-30" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ByteBuffer tmp = <span style="color:#871094;">recvQueue</span>.newByteBuffer(); //申请8192的buffer<br><span style="color:#0033b3;">while </span>(<span style="color:#871094;">recvQueue</span>.hasRemaining()) {<br> ((<span style="color:#000000;">Buffer</span>) <span style="color:#000000;">tmp</span>).clear();<br> <span style="color:#871094;">recvQueue</span>.get(<span style="color:#000000;">tmp</span>);<br> ((<span style="color:#000000;">Buffer</span>) <span style="color:#000000;">tmp</span>).flip();<br> <span style="color:#871094;">ptr</span>.onRecv(<span style="color:#000000;">tmp</span>);<br>}</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="4110" y="3900" width="520" height="160" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-31" value="" style="shape=curlyBracket;whiteSpace=wrap;html=1;rounded=1;flipH=1;labelPosition=right;verticalLabelPosition=middle;align=left;verticalAlign=middle;rotation=90;" parent="1" vertex="1">
<mxGeometry x="4110" y="3850" width="80" height="530" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-32" value="<b>由上我们知道每次处理不超过8192字节;不管是发送还是接收</b>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="4040" y="4150" width="240" height="90" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-33" value="<div style="text-align: left;">onRecv(<span style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt; text-align: center;">ByteBuffer </span><span style="background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt; text-align: center;">data</span><span style="background-color: initial;">) {</span></div><pre style="text-align: left; background-color: rgb(255, 255, 255); color: rgb(8, 8, 8); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"> next().onRecv(data)</pre><div style="text-align: left;"><span style="background-color: initial;">}</span></div>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3250" y="3410" width="270" height="90" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-34" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="3368.67" y="3510" as="sourcePoint" />
<mxPoint x="3369" y="3620" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-35" value="本层接收不做任何处理,直接让上层处理" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="3250" y="3640" width="260" height="70" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-36" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">onRecv(<span style="color:#000000;">ByteBuffer </span>data)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="2265" y="3410" width="265" height="40" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-37" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="2280" y="3490" as="sourcePoint" />
<mxPoint x="2280" y="3580" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-38" value="recvQueue中没有数据则直接处理<br><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ptr.onRecv(data)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="2180" y="3600" width="200" height="40" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-39" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="2545" y="3490" as="sourcePoint" />
<mxPoint x="2545" y="3560" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-40" value="recvQueue有数据则放入recvQueue中排队<br><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">recvQueue.put(data)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="2465" y="3580" width="245" height="30" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-41" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">flushRecv()</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="2465" y="3620" width="200" height="30" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-42" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="2545" y="3650" as="sourcePoint" />
<mxPoint x="2545" y="3720" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-43" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ByteBuffer tmp = <span style="color:#871094;">recvQueue</span>.newByteBuffer(); //申请8192的buffer<br><span style="color:#0033b3;">while </span>(<span style="color:#871094;">recvQueue</span>.hasRemaining()) {<br> ((<span style="color:#000000;">Buffer</span>) <span style="color:#000000;">tmp</span>).clear();<br> <span style="color:#871094;">recvQueue</span>.get(<span style="color:#000000;">tmp</span>);<br> ((<span style="color:#000000;">Buffer</span>) <span style="color:#000000;">tmp</span>).flip();<br> <span style="color:#871094;">ptr</span>.onRecv(<span style="color:#000000;">tmp</span>);<br>}</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="2465" y="3725" width="520" height="160" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-44" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">onRecv(<span style="color:#000000;">ByteBuffer </span>readBuffer)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="235" y="3410" width="245" height="40" as="geometry" />
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-45" value="" style="endArrow=classic;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="349.33" y="3470" as="sourcePoint" />
<mxPoint x="349.33" y="3530" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="0n1Nj1Sivc76l-1BmOpA-46" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><br></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">if (<span style="color:#871094;">previous </span>!= <span style="color:#0033b3;">null</span>) {<br> <span style="color:#000000;">tempBuffer </span>= <span style="color:#871094;">previous </span>= <span style="color:#000000;">ByteBufferUtils</span>.<span style="font-style:italic;">accumulate</span>(readBuffer, <span style="color:#871094;">previous</span>);<br>} <span style="color:#0033b3;">else </span>{<br> <span style="color:#000000;">tempBuffer </span>= readBuffer;<br></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><span style="font-size: 9.8pt;">}</span></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="border-color: var(--border-color); font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">//向IoHub中的bufferPool申请一个limit 16704(capacity实际是16916)的ByteBuffer</pre></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">ByteBuffer appBuffer = stack().acquire(sslEngine.getSession().getApplicationBufferSize()); </pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">result = <span style="color:#871094;">sslEngine</span>.unwrap(<span style="color:#000000;">tempBuffer</span>, <span style="color:#000000;">appBuffer</span>);</pre><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">((Buffer) <span style="color:#000000;">appBuffer</span>).flip();</pre><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">next().onRecv(appBuffer);</pre><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;"><br></pre></pre>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="114" y="3630" width="1579" height="70" as="geometry" />
</mxCell>
<mxCell id="Hq2ewR72OK_mTviOB1mo-1" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">JnlpProtocol4Handler.connect(....)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="425" y="610" width="436" height="30" as="geometry" />
</mxCell>
<mxCell id="Hq2ewR72OK_mTviOB1mo-2" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="375" y="650" as="sourcePoint" />
<mxPoint x="1035" y="650" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="Hq2ewR72OK_mTviOB1mo-3" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">6.connect</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="277" y="590" width="90" height="25" as="geometry" />
</mxCell>
<mxCell id="7xBDg8h49Le0EDPpn1vZ-2" value="" style="shape=curlyBracket;whiteSpace=wrap;html=1;rounded=1;flipH=1;labelPosition=right;verticalLabelPosition=middle;align=left;verticalAlign=middle;rotation=90;" parent="1" vertex="1">
<mxGeometry x="2420" y="3710" width="80" height="530" as="geometry" />
</mxCell>
<mxCell id="7xBDg8h49Le0EDPpn1vZ-3" value="最大8192字节" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="2340" y="4040" width="210" height="30" as="geometry" />
</mxCell>
<mxCell id="7xBDg8h49Le0EDPpn1vZ-4" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><b>AckFilterLayer的作用:</b></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><b>发送“ACK”字符串</b></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><b>接收“ACK”字符串</b></pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><b>只有这两样处理完成,才能进一步send其他数据, 不然就放在sendQueue里</b></pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="2185" y="4092" width="520" height="160" as="geometry" />
</mxCell>
<mxCell id="5ELjpxrQgCRXJpdXmUJf-1" value="" style="shape=link;html=1;rounded=0;edgeStyle=orthogonalEdgeStyle;" parent="1" edge="1">
<mxGeometry width="100" relative="1" as="geometry">
<mxPoint x="-2050" y="4110" as="sourcePoint" />
<mxPoint x="4980.34" y="4123" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="5ELjpxrQgCRXJpdXmUJf-2" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">listener = JnlpProtocol4Handler#Handler</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="294" y="3880" width="336" height="30" as="geometry" />
</mxCell>
<mxCell id="5ELjpxrQgCRXJpdXmUJf-4" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="424" y="3920" as="sourcePoint" />
<mxPoint x="424" y="3970" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="5ELjpxrQgCRXJpdXmUJf-5" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">listener.onHandshakeCompleted(<span style="color:#871094;">sslEngine</span>.getSession())</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="290" y="3980" width="431" height="20" as="geometry" />
</mxCell>
<mxCell id="5ELjpxrQgCRXJpdXmUJf-6" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="424" y="4020" as="sourcePoint" />
<mxPoint x="424" y="4070" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="5ELjpxrQgCRXJpdXmUJf-7" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">jnlp4ConnectionState.fireBeforeProperties(X509Certificate)</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="288" y="4084" width="403" height="26" as="geometry" />
</mxCell>
<mxCell id="5ELjpxrQgCRXJpdXmUJf-8" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="425" y="4120" as="sourcePoint" />
<mxPoint x="425" y="4170" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="5ELjpxrQgCRXJpdXmUJf-10" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">this.<span style="color:#871094;">certificate </span>= certificate; //保存证书到jnlp4ConnectionState</pre><pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">lifecycle = <span style="color:#000000;">State</span>.<span style="color:#871094;font-style:italic;">BEFORE_PROPERTIES</span>;//设置生命周期到jnlp4ConnectionState</pre></pre>listener=Engine#EngineJnlpConnectionStateListener<br>listerner.beforeProperties(jnlp4ConnectionState<span style="background-color: initial;">)</span>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="239.25" y="4170" width="590.75" height="70" as="geometry" />
</mxCell>
<mxCell id="5ELjpxrQgCRXJpdXmUJf-11" value="listerner.beforeProperties(jnlp4ConnectionState)主要是验证证书的有效性(从证书拿出公钥比较)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="340" y="4280" width="299" height="30" as="geometry" />
</mxCell>
<mxCell id="086Q5PK0GUfrbWCXx4qv-9" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;">listener = JnlpProtocol4Handler#Handler</pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-714" y="3940" width="336" height="30" as="geometry" />
</mxCell>
<mxCell id="086Q5PK0GUfrbWCXx4qv-10" value="" style="endArrow=classic;html=1;rounded=0;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="-584" y="3980" as="sourcePoint" />
<mxPoint x="-584" y="4030" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="086Q5PK0GUfrbWCXx4qv-11" value="<pre style="background-color:#ffffff;color:#080808;font-family:'JetBrains Mono',monospace;font-size:9.8pt;"><pre style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt;">listener.onReceiveHeaders(<span style="color:#000000;">headers</span>)</pre></pre>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-718" y="4040" width="431" height="20" as="geometry" />
</mxCell>