girl 9.1.6 → 9.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/girl/head.rb +2 -2
- data/lib/girl/proxy.rb +24 -12
- data/lib/girl/proxy_worker.rb +147 -28
- data/lib/girl/proxyd.rb +24 -12
- data/lib/girl/proxyd_worker.rb +191 -55
- data/lib/girl/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0fb6e8b23d6592879331b008463de29fd523fa803ec64de30b276c21b6363c6e
|
|
4
|
+
data.tar.gz: ad47b37c7378b2ac44be6b1f2d6fcea90eed1367b2f17d878e60fad943abe82b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b9167e14d9e01219abe7ea2005bc340d75cb22427d6b31d37de53a78b1be6af52e65fbd8282e45d55a54abe8f2f8239fbe5d66fe203191e2362c6e538f3be4e7
|
|
7
|
+
data.tar.gz: a9f9c2298974bd7dd84d30d591aa0d76be07249f6c89135b409f1ba256ab36566c4ee46cef6294bcad8af65487ecec7df6aa2a09afa367bfd41b223e63526fc5
|
data/lib/girl/head.rb
CHANGED
|
@@ -2,8 +2,8 @@ module Girl
|
|
|
2
2
|
BACKLOG = 512 # 听队列大小,满后掉SYN包
|
|
3
3
|
RLIMIT = 1024 # sock数上限
|
|
4
4
|
READ_SIZE = 1 * 1024 * 1024 # 一次最多读多少
|
|
5
|
-
WBUFF_LIMIT =
|
|
6
|
-
CLOSE_ABOVE =
|
|
5
|
+
WBUFF_LIMIT = 20 * 1024 * 1024 # 写前上限,超过上限暂停读另一头
|
|
6
|
+
CLOSE_ABOVE = 200 * 1024 * 1024 # 超过多少强制关闭
|
|
7
7
|
HEARTBEAT_INTERVAL = 10 # 心跳间隔
|
|
8
8
|
CHECK_TRAFF_INTERVAL = 3600 # 多久检查一次,今天是不是流量计数重置日
|
|
9
9
|
HTTP_OK = "HTTP/1.1 200 OK\r\n\r\n"
|
data/lib/girl/proxy.rb
CHANGED
|
@@ -33,18 +33,22 @@ module Girl
|
|
|
33
33
|
remote_path = conf[:remote_path]
|
|
34
34
|
appd_host = conf[:appd_host]
|
|
35
35
|
appd_port = conf[:appd_port]
|
|
36
|
-
head_len = conf[:head_len]
|
|
37
|
-
h_a_new_source = conf[:h_a_new_source]
|
|
38
|
-
h_a_new_p2 = conf[:h_a_new_p2]
|
|
39
|
-
h_dst_close = conf[:h_dst_close]
|
|
40
|
-
h_heartbeat = conf[:h_heartbeat]
|
|
41
|
-
h_p1_close = conf[:h_p1_close]
|
|
42
|
-
h_p2_close = conf[:h_p2_close]
|
|
43
|
-
h_p2_traffic = conf[:h_p2_traffic]
|
|
44
|
-
h_query = conf[:h_query]
|
|
45
|
-
h_response = conf[:h_response]
|
|
46
|
-
h_src_close = conf[:h_src_close]
|
|
47
|
-
h_traffic = conf[:h_traffic]
|
|
36
|
+
head_len = conf[:head_len] # 头长度
|
|
37
|
+
h_a_new_source = conf[:h_a_new_source] # A
|
|
38
|
+
h_a_new_p2 = conf[:h_a_new_p2] # B
|
|
39
|
+
h_dst_close = conf[:h_dst_close] # D
|
|
40
|
+
h_heartbeat = conf[:h_heartbeat] # H
|
|
41
|
+
h_p1_close = conf[:h_p1_close] # I
|
|
42
|
+
h_p2_close = conf[:h_p2_close] # J
|
|
43
|
+
h_p2_traffic = conf[:h_p2_traffic] # K
|
|
44
|
+
h_query = conf[:h_query] # Q
|
|
45
|
+
h_response = conf[:h_response] # R
|
|
46
|
+
h_src_close = conf[:h_src_close] # S
|
|
47
|
+
h_traffic = conf[:h_traffic] # T
|
|
48
|
+
h_dst_switch_to_big = conf[:h_dst_switch_to_big] # U
|
|
49
|
+
h_p2_switch_to_big = conf[:h_p2_switch_to_big] # V
|
|
50
|
+
h_src_switch_to_big = conf[:h_src_switch_to_big] # W
|
|
51
|
+
h_p1_switch_to_big = conf[:h_p1_switch_to_big] # X
|
|
48
52
|
expire_connecting = conf[:expire_connecting] # 连接多久没有建成关闭(秒)
|
|
49
53
|
expire_long_after = conf[:expire_long_after] # 长连接多久没有新流量关闭(秒)
|
|
50
54
|
expire_proxy_after = conf[:expire_proxy_after] # proxy多久没有收到流量重建(秒)
|
|
@@ -91,6 +95,10 @@ module Girl
|
|
|
91
95
|
h_response = h_response ? h_response.to_s : 'R'
|
|
92
96
|
h_src_close = h_src_close ? h_src_close.to_s : 'S'
|
|
93
97
|
h_traffic = h_traffic ? h_traffic.to_s : 'T'
|
|
98
|
+
h_dst_switch_to_big = h_dst_switch_to_big ? h_dst_switch_to_big.to_s : 'U'
|
|
99
|
+
h_p2_switch_to_big = h_p2_switch_to_big ? h_p2_switch_to_big.to_s : 'V'
|
|
100
|
+
h_src_switch_to_big = h_src_switch_to_big ? h_src_switch_to_big.to_s : 'W'
|
|
101
|
+
h_p1_switch_to_big = h_p1_switch_to_big ? h_p1_switch_to_big.to_s : 'X'
|
|
94
102
|
expire_connecting = expire_connecting ? expire_connecting.to_i : 5
|
|
95
103
|
expire_long_after = expire_long_after ? expire_long_after.to_i : 3600
|
|
96
104
|
expire_proxy_after = expire_proxy_after ? expire_proxy_after.to_i : 60
|
|
@@ -144,6 +152,10 @@ module Girl
|
|
|
144
152
|
h_response,
|
|
145
153
|
h_src_close,
|
|
146
154
|
h_traffic,
|
|
155
|
+
h_dst_switch_to_big,
|
|
156
|
+
h_p2_switch_to_big,
|
|
157
|
+
h_src_switch_to_big,
|
|
158
|
+
h_p1_switch_to_big,
|
|
147
159
|
expire_connecting,
|
|
148
160
|
expire_long_after,
|
|
149
161
|
expire_proxy_after,
|
data/lib/girl/proxy_worker.rb
CHANGED
|
@@ -29,6 +29,10 @@ module Girl
|
|
|
29
29
|
h_response,
|
|
30
30
|
h_src_close,
|
|
31
31
|
h_traffic,
|
|
32
|
+
h_dst_switch_to_big,
|
|
33
|
+
h_p2_switch_to_big,
|
|
34
|
+
h_src_switch_to_big,
|
|
35
|
+
h_p1_switch_to_big,
|
|
32
36
|
expire_connecting,
|
|
33
37
|
expire_long_after,
|
|
34
38
|
expire_proxy_after,
|
|
@@ -55,7 +59,7 @@ module Girl
|
|
|
55
59
|
@proxy_infos = {} # proxy => {:is_syn :rbuff :recv_at :wbuff}
|
|
56
60
|
@big_infos = {} # big => {:is_syn :overflowing :rbuff :recv_at :wbuff}
|
|
57
61
|
@mem_infos = {} # mem => {:wbuff}
|
|
58
|
-
@src_infos = {} # src => {:addrinfo :closing :destination_domain :destination_port :dst :in :is_big :is_connect :overflowing :proxy_proto :proxy_type :rbuff :src_id :wbuff}
|
|
62
|
+
@src_infos = {} # src => {:addrinfo :closing :destination_domain :destination_port :dst :in :is_big :is_connect :overflowing :proxy_proto :proxy_type :rbuff :src_id :switched :wbuff :wpend}
|
|
59
63
|
@dst_infos = {} # dst => {:closing :connected :domain :ip :overflowing :port :src :wbuff}
|
|
60
64
|
@dns_infos = {} # dns => {:domain :src}
|
|
61
65
|
@rsv_infos = {} # rsv => {:addrinfo :domain :type}
|
|
@@ -64,7 +68,7 @@ module Girl
|
|
|
64
68
|
@is_direct_caches = {} # ip => true / false
|
|
65
69
|
@response_caches = {} # domain => [response created_at ip is_remote]
|
|
66
70
|
@response6_caches = {} # domain => [response created_at ip is_remote]
|
|
67
|
-
@p1_infos = {} # p1 => {:closing :connected :in :is_big :overflowing :p2_id :wbuff}
|
|
71
|
+
@p1_infos = {} # p1 => {:closing :connected :in :is_big :overflowing :p2_id :switched :wbuff :wpend}
|
|
68
72
|
@appd_addr = Socket.sockaddr_in(appd_port, appd_host)
|
|
69
73
|
@head_len = head_len
|
|
70
74
|
@h_a_new_source = h_a_new_source
|
|
@@ -78,6 +82,10 @@ module Girl
|
|
|
78
82
|
@h_response = h_response
|
|
79
83
|
@h_src_close = h_src_close
|
|
80
84
|
@h_traffic = h_traffic
|
|
85
|
+
@h_dst_switch_to_big = h_dst_switch_to_big
|
|
86
|
+
@h_p2_switch_to_big = h_p2_switch_to_big
|
|
87
|
+
@h_src_switch_to_big = h_src_switch_to_big
|
|
88
|
+
@h_p1_switch_to_big = h_p1_switch_to_big
|
|
81
89
|
@expire_connecting = expire_connecting
|
|
82
90
|
@expire_long_after = expire_long_after
|
|
83
91
|
@expire_proxy_after = expire_proxy_after
|
|
@@ -246,6 +254,30 @@ module Girl
|
|
|
246
254
|
add_write(p1)
|
|
247
255
|
end
|
|
248
256
|
|
|
257
|
+
def add_p1_wpend(p1, data)
|
|
258
|
+
return if p1.nil? || p1.closed? || data.nil? || data.empty?
|
|
259
|
+
p1_info = @p1_infos[p1]
|
|
260
|
+
puts "add p1 wpend #{data.bytesize}" if @is_debug
|
|
261
|
+
p1_info[:wpend] << data
|
|
262
|
+
bytesize = p1_info[:wpend].bytesize
|
|
263
|
+
p2_id = p1_info[:p2_id]
|
|
264
|
+
|
|
265
|
+
if bytesize >= CLOSE_ABOVE
|
|
266
|
+
puts "p1 wpend full"
|
|
267
|
+
close_p1(p1)
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
if !p1_info[:overflowing] && (bytesize >= WBUFF_LIMIT)
|
|
271
|
+
puts "p1 overflow #{p2_id}"
|
|
272
|
+
p1_info[:overflowing] = true
|
|
273
|
+
|
|
274
|
+
if @big
|
|
275
|
+
puts 'pause big'
|
|
276
|
+
@reads.delete(@big)
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
|
|
249
281
|
def add_proxy_wbuff(data)
|
|
250
282
|
return if @proxy.closed? || data.nil? || data.empty?
|
|
251
283
|
proxy_info = @proxy_infos[@proxy]
|
|
@@ -291,7 +323,7 @@ module Girl
|
|
|
291
323
|
puts "add src rbuff #{data.bytesize}" if @is_debug
|
|
292
324
|
src_info[:rbuff] << data
|
|
293
325
|
|
|
294
|
-
if src_info[:rbuff].bytesize >=
|
|
326
|
+
if src_info[:rbuff].bytesize >= CLOSE_ABOVE
|
|
295
327
|
puts "src rbuff full"
|
|
296
328
|
close_src(src)
|
|
297
329
|
end
|
|
@@ -327,6 +359,34 @@ module Girl
|
|
|
327
359
|
add_write(src)
|
|
328
360
|
end
|
|
329
361
|
|
|
362
|
+
def add_src_wpend(src, data)
|
|
363
|
+
return if src.nil? || src.closed? || data.nil? || data.empty?
|
|
364
|
+
src_info = @src_infos[src]
|
|
365
|
+
puts "add src wpend #{data.bytesize}" if @is_debug
|
|
366
|
+
src_info[:wpend] << data
|
|
367
|
+
bytesize = src_info[:wpend].bytesize
|
|
368
|
+
src_id = src_info[:src_id]
|
|
369
|
+
domain = src_info[:destination_domain]
|
|
370
|
+
|
|
371
|
+
if bytesize >= CLOSE_ABOVE
|
|
372
|
+
puts "src wpend full"
|
|
373
|
+
close_src(src)
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
if !src_info[:overflowing] && (bytesize >= WBUFF_LIMIT)
|
|
377
|
+
puts "src overflow #{src_id} #{domain}"
|
|
378
|
+
src_info[:overflowing] = true
|
|
379
|
+
|
|
380
|
+
if src_info[:proxy_type] == :direct
|
|
381
|
+
puts "pause dst"
|
|
382
|
+
@reads.delete(src_info[:dst])
|
|
383
|
+
elsif src_info[:proxy_type] == :remote
|
|
384
|
+
puts "pause big"
|
|
385
|
+
@reads.delete(@big)
|
|
386
|
+
end
|
|
387
|
+
end
|
|
388
|
+
end
|
|
389
|
+
|
|
330
390
|
def add_write(sock)
|
|
331
391
|
return if sock.nil? || sock.closed? || @writes.include?(sock)
|
|
332
392
|
@writes << sock
|
|
@@ -521,15 +581,29 @@ module Girl
|
|
|
521
581
|
p2_id = data[1, 8].unpack('Q>').first
|
|
522
582
|
data = data[9..-1]
|
|
523
583
|
# puts "big got h_p2_traffic #{p2_id} #{data.bytesize}" if @is_debug
|
|
524
|
-
p1,
|
|
525
|
-
|
|
584
|
+
p1, p1_info = @p1_infos.find{|_, info| info[:p2_id] == p2_id}
|
|
585
|
+
|
|
586
|
+
if p1_info
|
|
587
|
+
if p1_info[:switched]
|
|
588
|
+
add_p1_wbuff(p1, data)
|
|
589
|
+
else
|
|
590
|
+
add_p1_wpend(p1, data)
|
|
591
|
+
end
|
|
592
|
+
end
|
|
526
593
|
when @h_traffic
|
|
527
594
|
return if data.bytesize < 9
|
|
528
595
|
src_id = data[1, 8].unpack('Q>').first
|
|
529
596
|
data = data[9..-1]
|
|
530
597
|
# puts "big got h_traffic #{src_id} #{data.bytesize}" if @is_debug
|
|
531
|
-
src,
|
|
532
|
-
|
|
598
|
+
src, src_info = @src_infos.find{|_, info| info[:src_id] == src_id}
|
|
599
|
+
|
|
600
|
+
if src_info
|
|
601
|
+
if src_info[:switched]
|
|
602
|
+
add_src_wbuff(src, data)
|
|
603
|
+
else
|
|
604
|
+
add_src_wpend(src, data)
|
|
605
|
+
end
|
|
606
|
+
end
|
|
533
607
|
end
|
|
534
608
|
end
|
|
535
609
|
|
|
@@ -599,6 +673,39 @@ module Girl
|
|
|
599
673
|
data = data[9..-1]
|
|
600
674
|
src, _ = @src_infos.find{|_, info| info[:src_id] == src_id}
|
|
601
675
|
add_src_wbuff(src, data)
|
|
676
|
+
when @h_dst_switch_to_big
|
|
677
|
+
return if data.bytesize < 9
|
|
678
|
+
src_id = data[1, 8].unpack('Q>').first
|
|
679
|
+
puts "got h_dst_switch_to_big #{src_id}" if @is_debug
|
|
680
|
+
src, src_info = @src_infos.find{|_, info| info[:src_id] == src_id}
|
|
681
|
+
|
|
682
|
+
if src_info && !src_info[:switched]
|
|
683
|
+
src_info[:switched] = true
|
|
684
|
+
|
|
685
|
+
unless src_info[:wpend].empty?
|
|
686
|
+
data = src_info[:wpend].dup
|
|
687
|
+
domain = src_info[:destination_domain]
|
|
688
|
+
puts "move src wpend to wbuff #{domain} #{data.bytesize}"
|
|
689
|
+
src_info[:wpend].clear
|
|
690
|
+
add_src_wbuff(src, data)
|
|
691
|
+
end
|
|
692
|
+
end
|
|
693
|
+
when @h_p2_switch_to_big
|
|
694
|
+
return if data.bytesize < 9
|
|
695
|
+
p2_id = data[1, 8].unpack('Q>').first
|
|
696
|
+
puts "got h_p2_switch_to_big #{p2_id}" if @is_debug
|
|
697
|
+
p1, p1_info = @p1_infos.find{|_, info| info[:p2_id] == p2_id}
|
|
698
|
+
|
|
699
|
+
if p1_info && !p1_info[:switched]
|
|
700
|
+
p1_info[:switched] = true
|
|
701
|
+
|
|
702
|
+
unless p1_info[:wpend].empty?
|
|
703
|
+
data = p1_info[:wpend].dup
|
|
704
|
+
puts "move p1 wpend to wbuff #{p2_id} #{data.bytesize}"
|
|
705
|
+
p1_info[:wpend].clear
|
|
706
|
+
add_p1_wbuff(p1, data)
|
|
707
|
+
end
|
|
708
|
+
end
|
|
602
709
|
end
|
|
603
710
|
end
|
|
604
711
|
|
|
@@ -768,10 +875,11 @@ module Girl
|
|
|
768
875
|
|
|
769
876
|
add_read(dst, :dst)
|
|
770
877
|
add_write(dst)
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
878
|
+
|
|
879
|
+
unless src_info[:rbuff].empty?
|
|
880
|
+
data = src_info[:rbuff].dup
|
|
774
881
|
puts "move src rbuff to dst #{domain} #{data.bytesize}" if @is_debug
|
|
882
|
+
src_info[:rbuff].clear
|
|
775
883
|
add_dst_wbuff(dst, data)
|
|
776
884
|
end
|
|
777
885
|
end
|
|
@@ -830,7 +938,9 @@ module Girl
|
|
|
830
938
|
is_big: false,
|
|
831
939
|
overflowing: false,
|
|
832
940
|
p2_id: p2_id,
|
|
833
|
-
|
|
941
|
+
switched: false,
|
|
942
|
+
wbuff: '',
|
|
943
|
+
wpend: ''
|
|
834
944
|
}
|
|
835
945
|
add_read(p1, :p1)
|
|
836
946
|
add_write(p1)
|
|
@@ -1161,9 +1271,16 @@ module Girl
|
|
|
1161
1271
|
p1_info[:in] += data.bytesize
|
|
1162
1272
|
p2_id = p1_info[:p2_id]
|
|
1163
1273
|
|
|
1274
|
+
if @proxy.closed?
|
|
1275
|
+
close_p1(p1)
|
|
1276
|
+
return
|
|
1277
|
+
end
|
|
1278
|
+
|
|
1164
1279
|
if !p1_info[:is_big] && (p1_info[:in] >= READ_SIZE)
|
|
1165
1280
|
puts "set p1 is big #{p2_id}"
|
|
1166
1281
|
p1_info[:is_big] = true
|
|
1282
|
+
msg = "#{@h_p1_switch_to_big}#{[p2_id].pack('Q>')}"
|
|
1283
|
+
add_proxy_wbuff(pack_a_chunk(msg))
|
|
1167
1284
|
end
|
|
1168
1285
|
|
|
1169
1286
|
data = pack_p2_traffic(p2_id, data)
|
|
@@ -1181,11 +1298,6 @@ module Girl
|
|
|
1181
1298
|
@reads.delete(p1)
|
|
1182
1299
|
end
|
|
1183
1300
|
else
|
|
1184
|
-
if @proxy.closed?
|
|
1185
|
-
close_p1(p1)
|
|
1186
|
-
return
|
|
1187
|
-
end
|
|
1188
|
-
|
|
1189
1301
|
add_proxy_wbuff(data)
|
|
1190
1302
|
end
|
|
1191
1303
|
end
|
|
@@ -1235,7 +1347,9 @@ module Girl
|
|
|
1235
1347
|
proxy_type: :uncheck, # :uncheck / :checking / :negotiation / :remote / :direct
|
|
1236
1348
|
rbuff: '',
|
|
1237
1349
|
src_id: src_id,
|
|
1238
|
-
|
|
1350
|
+
switched: false,
|
|
1351
|
+
wbuff: '',
|
|
1352
|
+
wpend: ''
|
|
1239
1353
|
}
|
|
1240
1354
|
add_read(src, :src)
|
|
1241
1355
|
end
|
|
@@ -1497,9 +1611,16 @@ module Girl
|
|
|
1497
1611
|
src_id = src_info[:src_id]
|
|
1498
1612
|
domain = src_info[:destination_domain]
|
|
1499
1613
|
|
|
1614
|
+
if @proxy.closed?
|
|
1615
|
+
close_src(src)
|
|
1616
|
+
return
|
|
1617
|
+
end
|
|
1618
|
+
|
|
1500
1619
|
if !src_info[:is_big] && (src_info[:in] >= READ_SIZE)
|
|
1501
1620
|
puts "set src is big #{src_id} #{domain}"
|
|
1502
1621
|
src_info[:is_big] = true
|
|
1622
|
+
msg = "#{@h_src_switch_to_big}#{[src_id].pack('Q>')}"
|
|
1623
|
+
add_proxy_wbuff(pack_a_chunk(msg))
|
|
1503
1624
|
end
|
|
1504
1625
|
|
|
1505
1626
|
data = pack_traffic(src_id, data)
|
|
@@ -1517,11 +1638,6 @@ module Girl
|
|
|
1517
1638
|
@reads.delete(src)
|
|
1518
1639
|
end
|
|
1519
1640
|
else
|
|
1520
|
-
if @proxy.closed?
|
|
1521
|
-
close_src(src)
|
|
1522
|
-
return
|
|
1523
|
-
end
|
|
1524
|
-
|
|
1525
1641
|
add_proxy_wbuff(data)
|
|
1526
1642
|
end
|
|
1527
1643
|
when :direct
|
|
@@ -1575,7 +1691,9 @@ module Girl
|
|
|
1575
1691
|
proxy_type: :uncheck, # :uncheck / :checking / :negotiation / :remote / :direct
|
|
1576
1692
|
rbuff: '',
|
|
1577
1693
|
src_id: src_id,
|
|
1578
|
-
|
|
1694
|
+
switched: false,
|
|
1695
|
+
wbuff: '',
|
|
1696
|
+
wpend: ''
|
|
1579
1697
|
}
|
|
1580
1698
|
add_read(src, :src)
|
|
1581
1699
|
make_tunnel(dest_ip, src)
|
|
@@ -1698,10 +1816,11 @@ module Girl
|
|
|
1698
1816
|
puts "add h_a_new_source #{src_id} #{domain_port}" if @is_debug
|
|
1699
1817
|
msg = "#{@h_a_new_source}#{[src_id].pack('Q>')}#{domain_port}"
|
|
1700
1818
|
add_proxy_wbuff(pack_a_chunk(msg))
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1819
|
+
|
|
1820
|
+
unless src_info[:rbuff].empty?
|
|
1821
|
+
data = src_info[:rbuff].dup
|
|
1704
1822
|
puts "move src rbuff to proxy #{domain} #{data.bytesize}" if @is_debug
|
|
1823
|
+
src_info[:rbuff].clear
|
|
1705
1824
|
add_proxy_wbuff(pack_traffic(src_id, data))
|
|
1706
1825
|
end
|
|
1707
1826
|
end
|
|
@@ -1910,7 +2029,7 @@ module Girl
|
|
|
1910
2029
|
p1_info[:wbuff] = data
|
|
1911
2030
|
p2_id = p1_info[:p2_id]
|
|
1912
2031
|
|
|
1913
|
-
if p1_info[:overflowing] && p1_info[:wbuff].empty?
|
|
2032
|
+
if p1_info[:overflowing] && p1_info[:wbuff].empty? && p1_info[:wpend].empty?
|
|
1914
2033
|
puts "p1 empty #{p2_id}"
|
|
1915
2034
|
p1_info[:overflowing] = false
|
|
1916
2035
|
puts "resume big"
|
|
@@ -1989,7 +2108,7 @@ module Girl
|
|
|
1989
2108
|
data = data[written..-1]
|
|
1990
2109
|
src_info[:wbuff] = data
|
|
1991
2110
|
|
|
1992
|
-
if src_info[:wbuff].empty? && src_info[:
|
|
2111
|
+
if src_info[:overflowing] && src_info[:wbuff].empty? && src_info[:wpend].empty?
|
|
1993
2112
|
src_id = src_info[:src_id]
|
|
1994
2113
|
domain = src_info[:destination_domain]
|
|
1995
2114
|
puts "src empty #{src_id} #{domain}"
|
data/lib/girl/proxyd.rb
CHANGED
|
@@ -24,18 +24,22 @@ module Girl
|
|
|
24
24
|
ims = conf[:ims]
|
|
25
25
|
p2d_host = conf[:p2d_host]
|
|
26
26
|
p2d_port = conf[:p2d_port]
|
|
27
|
-
head_len = conf[:head_len]
|
|
28
|
-
h_a_new_source = conf[:h_a_new_source]
|
|
29
|
-
h_a_new_p2 = conf[:h_a_new_p2]
|
|
30
|
-
h_dst_close = conf[:h_dst_close]
|
|
31
|
-
h_heartbeat = conf[:h_heartbeat]
|
|
32
|
-
h_p1_close = conf[:h_p1_close]
|
|
33
|
-
h_p2_close = conf[:h_p2_close]
|
|
34
|
-
h_p2_traffic = conf[:h_p2_traffic]
|
|
35
|
-
h_query = conf[:h_query]
|
|
36
|
-
h_response = conf[:h_response]
|
|
37
|
-
h_src_close = conf[:h_src_close]
|
|
38
|
-
h_traffic = conf[:h_traffic]
|
|
27
|
+
head_len = conf[:head_len] # 头长度
|
|
28
|
+
h_a_new_source = conf[:h_a_new_source] # A
|
|
29
|
+
h_a_new_p2 = conf[:h_a_new_p2] # B
|
|
30
|
+
h_dst_close = conf[:h_dst_close] # D
|
|
31
|
+
h_heartbeat = conf[:h_heartbeat] # H
|
|
32
|
+
h_p1_close = conf[:h_p1_close] # I
|
|
33
|
+
h_p2_close = conf[:h_p2_close] # J
|
|
34
|
+
h_p2_traffic = conf[:h_p2_traffic] # K
|
|
35
|
+
h_query = conf[:h_query] # Q
|
|
36
|
+
h_response = conf[:h_response] # R
|
|
37
|
+
h_src_close = conf[:h_src_close] # S
|
|
38
|
+
h_traffic = conf[:h_traffic] # T
|
|
39
|
+
h_dst_switch_to_big = conf[:h_dst_switch_to_big] # U
|
|
40
|
+
h_p2_switch_to_big = conf[:h_p2_switch_to_big] # V
|
|
41
|
+
h_src_switch_to_big = conf[:h_src_switch_to_big] # W
|
|
42
|
+
h_p1_switch_to_big = conf[:h_p1_switch_to_big] # X
|
|
39
43
|
expire_connecting = conf[:expire_connecting] # 连接多久没有建成关闭(秒)
|
|
40
44
|
expire_long_after = conf[:expire_long_after] # 长连接多久没有新流量关闭(秒)
|
|
41
45
|
expire_resolv_cache = conf[:expire_resolv_cache] # dns查询结果缓存多久(秒)
|
|
@@ -84,6 +88,10 @@ module Girl
|
|
|
84
88
|
h_response = h_response ? h_response.to_s : 'R'
|
|
85
89
|
h_src_close = h_src_close ? h_src_close.to_s : 'S'
|
|
86
90
|
h_traffic = h_traffic ? h_traffic.to_s : 'T'
|
|
91
|
+
h_dst_switch_to_big = h_dst_switch_to_big ? h_dst_switch_to_big.to_s : 'U'
|
|
92
|
+
h_p2_switch_to_big = h_p2_switch_to_big ? h_p2_switch_to_big.to_s : 'V'
|
|
93
|
+
h_src_switch_to_big = h_src_switch_to_big ? h_src_switch_to_big.to_s : 'W'
|
|
94
|
+
h_p1_switch_to_big = h_p1_switch_to_big ? h_p1_switch_to_big.to_s : 'X'
|
|
87
95
|
expire_connecting = expire_connecting ? expire_connecting.to_i : 5
|
|
88
96
|
expire_long_after = expire_long_after ? expire_long_after.to_i : 3600
|
|
89
97
|
expire_resolv_cache = expire_resolv_cache ? expire_resolv_cache.to_i : 600
|
|
@@ -127,6 +135,10 @@ module Girl
|
|
|
127
135
|
h_response,
|
|
128
136
|
h_src_close,
|
|
129
137
|
h_traffic,
|
|
138
|
+
h_dst_switch_to_big,
|
|
139
|
+
h_p2_switch_to_big,
|
|
140
|
+
h_src_switch_to_big,
|
|
141
|
+
h_p1_switch_to_big,
|
|
130
142
|
expire_connecting,
|
|
131
143
|
expire_long_after,
|
|
132
144
|
expire_resolv_cache,
|
data/lib/girl/proxyd_worker.rb
CHANGED
|
@@ -23,6 +23,10 @@ module Girl
|
|
|
23
23
|
h_response,
|
|
24
24
|
h_src_close,
|
|
25
25
|
h_traffic,
|
|
26
|
+
h_dst_switch_to_big,
|
|
27
|
+
h_p2_switch_to_big,
|
|
28
|
+
h_src_switch_to_big,
|
|
29
|
+
h_p1_switch_to_big,
|
|
26
30
|
expire_connecting,
|
|
27
31
|
expire_long_after,
|
|
28
32
|
expire_resolv_cache,
|
|
@@ -43,12 +47,12 @@ module Girl
|
|
|
43
47
|
@im_infos = {} # im => {:addrinfo :big :big_connect_at :in :out :p2d :p2d_host :p2d_port :proxy :proxy_connect_at}
|
|
44
48
|
@src_infos = {} # src_id => {:created_at :dst :im :rbuff}
|
|
45
49
|
@mem_infos = {} # mem => {:wbuff}
|
|
46
|
-
@dst_infos = {} # dst => {:closing :connected :domain :im :in :ip :is_big :overflowing :port :rbuffs :src_id :wbuff}
|
|
50
|
+
@dst_infos = {} # dst => {:closing :connected :domain :im :in :ip :is_big :overflowing :port :rbuffs :src_id :switched :wbuff :wpend}
|
|
47
51
|
@dns_infos = {} # dns => {:domain :im :port :src_id}
|
|
48
52
|
@rsv_infos = {} # rsv => {:domain :im :near_id}
|
|
49
53
|
@resolv_caches = {} # domain => [ip created_at]
|
|
50
54
|
@p2d_infos = {} # p2d => {:im}
|
|
51
|
-
@p2_infos = {} # p2 => {:addrinfo :closing :im :in :is_big :overflowing :p2_id :wbuff}
|
|
55
|
+
@p2_infos = {} # p2 => {:addrinfo :closing :im :in :is_big :overflowing :p2_id :switched :wbuff :wpend}
|
|
52
56
|
@head_len = head_len
|
|
53
57
|
@h_a_new_source = h_a_new_source
|
|
54
58
|
@h_a_new_p2 = h_a_new_p2
|
|
@@ -61,6 +65,10 @@ module Girl
|
|
|
61
65
|
@h_response = h_response
|
|
62
66
|
@h_src_close = h_src_close
|
|
63
67
|
@h_traffic = h_traffic
|
|
68
|
+
@h_dst_switch_to_big = h_dst_switch_to_big
|
|
69
|
+
@h_p2_switch_to_big = h_p2_switch_to_big
|
|
70
|
+
@h_src_switch_to_big = h_src_switch_to_big
|
|
71
|
+
@h_p1_switch_to_big = h_p1_switch_to_big
|
|
64
72
|
@expire_connecting = expire_connecting
|
|
65
73
|
@expire_long_after = expire_long_after
|
|
66
74
|
@expire_resolv_cache = expire_resolv_cache
|
|
@@ -199,6 +207,37 @@ module Girl
|
|
|
199
207
|
add_write(dst)
|
|
200
208
|
end
|
|
201
209
|
|
|
210
|
+
def add_dst_wpend(dst, data)
|
|
211
|
+
return if dst.nil? || dst.closed? || data.nil? || data.empty?
|
|
212
|
+
dst_info = @dst_infos[dst]
|
|
213
|
+
puts "add dst wpend #{data.bytesize}" if @is_debug
|
|
214
|
+
dst_info[:wpend] << data
|
|
215
|
+
bytesize = dst_info[:wpend].bytesize
|
|
216
|
+
im = dst_info[:im]
|
|
217
|
+
domain = dst_info[:domain]
|
|
218
|
+
|
|
219
|
+
if bytesize >= CLOSE_ABOVE
|
|
220
|
+
puts "dst wpend full"
|
|
221
|
+
close_dst(dst)
|
|
222
|
+
return
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
if !dst_info[:overflowing] && (bytesize >= WBUFF_LIMIT)
|
|
226
|
+
puts "dst overflow #{im} #{domain}"
|
|
227
|
+
dst_info[:overflowing] = true
|
|
228
|
+
im_info = @im_infos[im]
|
|
229
|
+
|
|
230
|
+
if im_info
|
|
231
|
+
big = im_info[:big]
|
|
232
|
+
|
|
233
|
+
if big
|
|
234
|
+
puts 'pause big'
|
|
235
|
+
@reads.delete(big)
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
|
|
202
241
|
def add_mem_wbuff(mem, data)
|
|
203
242
|
return if mem.nil? || mem.closed? || data.nil? || data.empty?
|
|
204
243
|
mem_info = @mem_infos[mem]
|
|
@@ -238,6 +277,37 @@ module Girl
|
|
|
238
277
|
add_write(p2)
|
|
239
278
|
end
|
|
240
279
|
|
|
280
|
+
def add_p2_wpend(p2, data)
|
|
281
|
+
return if p2.nil? || p2.closed? || data.nil? || data.empty?
|
|
282
|
+
p2_info = @p2_infos[p2]
|
|
283
|
+
puts "add p2 wpend #{data.bytesize}" if @is_debug
|
|
284
|
+
p2_info[:wpend] << data
|
|
285
|
+
bytesize = p2_info[:wpend].bytesize
|
|
286
|
+
im = p2_info[:im]
|
|
287
|
+
p2_id = p2_info[:p2_id]
|
|
288
|
+
|
|
289
|
+
if bytesize >= CLOSE_ABOVE
|
|
290
|
+
puts "p2 wpend full"
|
|
291
|
+
close_p2(p2)
|
|
292
|
+
return
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
if !p2_info[:overflowing] && (bytesize >= WBUFF_LIMIT)
|
|
296
|
+
puts "p2 overflow #{im} #{p2_id}"
|
|
297
|
+
p2_info[:overflowing] = true
|
|
298
|
+
im_info = @im_infos[im]
|
|
299
|
+
|
|
300
|
+
if im_info
|
|
301
|
+
big = im_info[:big]
|
|
302
|
+
|
|
303
|
+
if big
|
|
304
|
+
puts 'pause big'
|
|
305
|
+
@reads.delete(big)
|
|
306
|
+
end
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
|
|
241
311
|
def add_proxy_wbuff(proxy, data)
|
|
242
312
|
return if proxy.nil? || proxy.closed? || data.nil? || data.empty?
|
|
243
313
|
proxy_info = @proxy_infos[proxy]
|
|
@@ -269,27 +339,6 @@ module Girl
|
|
|
269
339
|
end
|
|
270
340
|
end
|
|
271
341
|
|
|
272
|
-
def add_src_rbuff(src_id, data)
|
|
273
|
-
src_info = @src_infos[src_id]
|
|
274
|
-
|
|
275
|
-
if src_info
|
|
276
|
-
im = src_info[:im]
|
|
277
|
-
dst = src_info[:dst]
|
|
278
|
-
|
|
279
|
-
if dst
|
|
280
|
-
add_dst_wbuff(dst, data)
|
|
281
|
-
else
|
|
282
|
-
puts "add src rbuff #{im} #{data.bytesize}" if @is_debug
|
|
283
|
-
src_info[:rbuff] << data
|
|
284
|
-
|
|
285
|
-
if src_info[:rbuff].bytesize >= WBUFF_LIMIT
|
|
286
|
-
puts "src rbuff full"
|
|
287
|
-
@src_infos.delete(src_id)
|
|
288
|
-
end
|
|
289
|
-
end
|
|
290
|
-
end
|
|
291
|
-
end
|
|
292
|
-
|
|
293
342
|
def add_write(sock)
|
|
294
343
|
return if sock.nil? || sock.closed? || @writes.include?(sock)
|
|
295
344
|
@writes << sock
|
|
@@ -499,14 +548,37 @@ module Girl
|
|
|
499
548
|
p2_id = data[1, 8].unpack('Q>').first
|
|
500
549
|
data = data[9..-1]
|
|
501
550
|
# puts "big got h_p2_traffic #{im} #{p2_id} #{data.bytesize}" if @is_debug
|
|
502
|
-
p2,
|
|
503
|
-
|
|
551
|
+
p2, p2_info = @p2_infos.find{|_, info| (info[:im] == im) && (info[:p2_id] == p2_id)}
|
|
552
|
+
|
|
553
|
+
if p2_info
|
|
554
|
+
if p2_info[:switched]
|
|
555
|
+
add_p2_wbuff(p2, data)
|
|
556
|
+
else
|
|
557
|
+
add_p2_wpend(p2, data)
|
|
558
|
+
end
|
|
559
|
+
end
|
|
504
560
|
when @h_traffic
|
|
505
561
|
return if data.bytesize < 9
|
|
506
562
|
src_id = data[1, 8].unpack('Q>').first
|
|
507
563
|
data = data[9..-1]
|
|
508
564
|
# puts "big got h_traffic #{im} #{src_id} #{data.bytesize}" if @is_debug
|
|
509
|
-
|
|
565
|
+
src_info = @src_infos[src_id]
|
|
566
|
+
|
|
567
|
+
if src_info
|
|
568
|
+
dst = src_info[:dst]
|
|
569
|
+
|
|
570
|
+
if dst
|
|
571
|
+
dst_info = @dst_infos[dst]
|
|
572
|
+
|
|
573
|
+
if dst_info
|
|
574
|
+
if dst_info[:switched]
|
|
575
|
+
add_dst_wbuff(dst, data)
|
|
576
|
+
else
|
|
577
|
+
add_dst_wpend(dst, data)
|
|
578
|
+
end
|
|
579
|
+
end
|
|
580
|
+
end
|
|
581
|
+
end
|
|
510
582
|
end
|
|
511
583
|
end
|
|
512
584
|
|
|
@@ -561,7 +633,64 @@ module Girl
|
|
|
561
633
|
return if data.bytesize < 9
|
|
562
634
|
src_id = data[1, 8].unpack('Q>').first
|
|
563
635
|
data = data[9..-1]
|
|
564
|
-
|
|
636
|
+
src_info = @src_infos[src_id]
|
|
637
|
+
|
|
638
|
+
if src_info
|
|
639
|
+
dst = src_info[:dst]
|
|
640
|
+
|
|
641
|
+
if dst
|
|
642
|
+
add_dst_wbuff(dst, data)
|
|
643
|
+
else
|
|
644
|
+
puts "add src rbuff #{im} #{data.bytesize}" if @is_debug
|
|
645
|
+
src_info[:rbuff] << data
|
|
646
|
+
|
|
647
|
+
if src_info[:rbuff].bytesize >= CLOSE_ABOVE
|
|
648
|
+
puts "src rbuff full"
|
|
649
|
+
@src_infos.delete(src_id)
|
|
650
|
+
end
|
|
651
|
+
end
|
|
652
|
+
end
|
|
653
|
+
when @h_src_switch_to_big
|
|
654
|
+
return if data.bytesize < 9
|
|
655
|
+
src_id = data[1, 8].unpack('Q>').first
|
|
656
|
+
puts "got h_src_switch_to_big #{src_id}" if @is_debug
|
|
657
|
+
src_info = @src_infos[src_id]
|
|
658
|
+
|
|
659
|
+
if src_info
|
|
660
|
+
dst = src_info[:dst]
|
|
661
|
+
|
|
662
|
+
if dst
|
|
663
|
+
dst_info = @dst_infos[dst]
|
|
664
|
+
|
|
665
|
+
if dst_info && !dst_info[:switched]
|
|
666
|
+
dst_info[:switched] = true
|
|
667
|
+
|
|
668
|
+
unless dst_info[:wpend].empty?
|
|
669
|
+
data = dst_info[:wpend].dup
|
|
670
|
+
domain = dst_info[:domain]
|
|
671
|
+
puts "move dst wpend to wbuff #{domain} #{data.bytesize}"
|
|
672
|
+
dst_info[:wpend].clear
|
|
673
|
+
add_dst_wbuff(dst, data)
|
|
674
|
+
end
|
|
675
|
+
end
|
|
676
|
+
end
|
|
677
|
+
end
|
|
678
|
+
when @h_p1_switch_to_big
|
|
679
|
+
return if data.bytesize < 9
|
|
680
|
+
p2_id = data[1, 8].unpack('Q>').first
|
|
681
|
+
puts "got h_p1_switch_to_big #{p2_id}" if @is_debug
|
|
682
|
+
p2, p2_info = @p2_infos.find{|_, info| (info[:im] == im) && (info[:p2_id] == p2_id)}
|
|
683
|
+
|
|
684
|
+
if p2_info && !p2_info[:switched]
|
|
685
|
+
p2_info[:switched] = true
|
|
686
|
+
|
|
687
|
+
unless p2_info[:wpend].empty?
|
|
688
|
+
data = p2_info[:wpend].dup
|
|
689
|
+
puts "move p2 wpend to wbuff #{p2_id} #{data.bytesize}"
|
|
690
|
+
p2_info[:wpend].clear
|
|
691
|
+
add_p2_wbuff(p2, data)
|
|
692
|
+
end
|
|
693
|
+
end
|
|
565
694
|
end
|
|
566
695
|
end
|
|
567
696
|
|
|
@@ -685,12 +814,15 @@ module Girl
|
|
|
685
814
|
port: port,
|
|
686
815
|
rbuffs: [],
|
|
687
816
|
src_id: src_id,
|
|
688
|
-
|
|
817
|
+
switched: false,
|
|
818
|
+
wbuff: src_info[:rbuff].dup,
|
|
819
|
+
wpend: ''
|
|
689
820
|
}
|
|
690
821
|
|
|
691
822
|
@dst_infos[dst] = dst_info
|
|
692
823
|
add_read(dst, :dst)
|
|
693
824
|
add_write(dst)
|
|
825
|
+
src_info[:rbuff].clear
|
|
694
826
|
src_info[:dst] = dst
|
|
695
827
|
end
|
|
696
828
|
|
|
@@ -958,19 +1090,27 @@ module Girl
|
|
|
958
1090
|
im = dst_info[:im]
|
|
959
1091
|
src_id = dst_info[:src_id]
|
|
960
1092
|
domain = dst_info[:domain]
|
|
1093
|
+
im_info = @im_infos[im]
|
|
961
1094
|
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1095
|
+
unless im_info
|
|
1096
|
+
close_dst(dst)
|
|
1097
|
+
return
|
|
965
1098
|
end
|
|
966
1099
|
|
|
967
|
-
|
|
1100
|
+
proxy = im_info[:proxy]
|
|
968
1101
|
|
|
969
|
-
|
|
1102
|
+
if proxy.nil? || proxy.closed?
|
|
970
1103
|
close_dst(dst)
|
|
971
1104
|
return
|
|
972
1105
|
end
|
|
973
1106
|
|
|
1107
|
+
if !dst_info[:is_big] && (dst_info[:in] >= READ_SIZE)
|
|
1108
|
+
puts "set dst is big #{im} #{src_id} #{domain}"
|
|
1109
|
+
dst_info[:is_big] = true
|
|
1110
|
+
msg = "#{@h_dst_switch_to_big}#{[src_id].pack('Q>')}"
|
|
1111
|
+
add_proxy_wbuff(proxy, pack_a_chunk(msg))
|
|
1112
|
+
end
|
|
1113
|
+
|
|
974
1114
|
im_info[:in] += data.bytesize
|
|
975
1115
|
data = pack_traffic(src_id, data)
|
|
976
1116
|
|
|
@@ -989,13 +1129,6 @@ module Girl
|
|
|
989
1129
|
@reads.delete(dst)
|
|
990
1130
|
end
|
|
991
1131
|
else
|
|
992
|
-
proxy = im_info[:proxy]
|
|
993
|
-
|
|
994
|
-
if proxy.nil? || proxy.closed?
|
|
995
|
-
close_dst(dst)
|
|
996
|
-
return
|
|
997
|
-
end
|
|
998
|
-
|
|
999
1132
|
add_proxy_wbuff(proxy, data)
|
|
1000
1133
|
end
|
|
1001
1134
|
end
|
|
@@ -1115,19 +1248,27 @@ module Girl
|
|
|
1115
1248
|
p2_info[:in] += data.bytesize
|
|
1116
1249
|
im = p2_info[:im]
|
|
1117
1250
|
p2_id = p2_info[:p2_id]
|
|
1251
|
+
im_info = @im_infos[im]
|
|
1118
1252
|
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1253
|
+
unless im_info
|
|
1254
|
+
close_p2(p2)
|
|
1255
|
+
return
|
|
1122
1256
|
end
|
|
1123
1257
|
|
|
1124
|
-
|
|
1258
|
+
proxy = im_info[:proxy]
|
|
1125
1259
|
|
|
1126
|
-
|
|
1260
|
+
if proxy.nil? || proxy.closed?
|
|
1127
1261
|
close_p2(p2)
|
|
1128
1262
|
return
|
|
1129
1263
|
end
|
|
1130
1264
|
|
|
1265
|
+
if !p2_info[:is_big] && (p2_info[:in] >= READ_SIZE)
|
|
1266
|
+
puts "set p2 is big #{im} #{p2_id}"
|
|
1267
|
+
p2_info[:is_big] = true
|
|
1268
|
+
msg = "#{@h_p2_switch_to_big}#{[p2_id].pack('Q>')}"
|
|
1269
|
+
add_proxy_wbuff(proxy, pack_a_chunk(msg))
|
|
1270
|
+
end
|
|
1271
|
+
|
|
1131
1272
|
data = pack_p2_traffic(p2_id, data)
|
|
1132
1273
|
|
|
1133
1274
|
if p2_info[:is_big]
|
|
@@ -1145,13 +1286,6 @@ module Girl
|
|
|
1145
1286
|
@reads.delete(p2)
|
|
1146
1287
|
end
|
|
1147
1288
|
else
|
|
1148
|
-
proxy = im_info[:proxy]
|
|
1149
|
-
|
|
1150
|
-
if proxy.nil? || proxy.closed?
|
|
1151
|
-
close_p2(p2)
|
|
1152
|
-
return
|
|
1153
|
-
end
|
|
1154
|
-
|
|
1155
1289
|
add_proxy_wbuff(proxy, data)
|
|
1156
1290
|
end
|
|
1157
1291
|
end
|
|
@@ -1177,7 +1311,9 @@ module Girl
|
|
|
1177
1311
|
is_big: false, # 是否收流量大户
|
|
1178
1312
|
overflowing: false,
|
|
1179
1313
|
p2_id: p2_id,
|
|
1180
|
-
|
|
1314
|
+
switched: false,
|
|
1315
|
+
wbuff: '',
|
|
1316
|
+
wpend: ''
|
|
1181
1317
|
}
|
|
1182
1318
|
add_read(p2, :p2)
|
|
1183
1319
|
im_info = @im_infos[im]
|
|
@@ -1537,7 +1673,7 @@ module Girl
|
|
|
1537
1673
|
src_id = dst_info[:src_id]
|
|
1538
1674
|
domain = dst_info[:domain]
|
|
1539
1675
|
|
|
1540
|
-
if dst_info[:wbuff].empty? && dst_info[:
|
|
1676
|
+
if dst_info[:overflowing] && dst_info[:wbuff].empty? && dst_info[:wpend].empty?
|
|
1541
1677
|
puts "dst empty #{im} #{src_id} #{domain}"
|
|
1542
1678
|
dst_info[:overflowing] = false
|
|
1543
1679
|
|
|
@@ -1617,7 +1753,7 @@ module Girl
|
|
|
1617
1753
|
p2_info[:wbuff] = data
|
|
1618
1754
|
p2_id = p2_info[:p2_id]
|
|
1619
1755
|
|
|
1620
|
-
if p2_info[:overflowing] && p2_info[:wbuff].empty?
|
|
1756
|
+
if p2_info[:overflowing] && p2_info[:wbuff].empty? && p2_info[:wpend].empty?
|
|
1621
1757
|
puts "p2 empty #{im} #{p2_id}"
|
|
1622
1758
|
p2_info[:overflowing] = false
|
|
1623
1759
|
|
data/lib/girl/version.rb
CHANGED