Repository navigation
Expand file tree
/
Copy pathai.java
More file actions
140 lines (124 loc) · 3.71 KB
/
Copy pathai.java
File metadata and controls
140 lines (124 loc) · 3.71 KB
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
import java.io.DataInputStream;
import java.io.IOException;
import java.io.OutputStream;
import javax.microedition.io.Connector;
import javax.microedition.io.SocketConnection;
import net.rim.device.api.system.CoverageInfo;
import net.rim.device.api.system.EventLogger;
import net.rim.device.api.system.WLANInfo;
import tibiame.Main;
public final class ai implements cj {
static final int MBOOSTER_MAX_INSTANCES = 1;
private boolean a;
private DataInputStream b;
private OutputStream c;
private SocketConnection d;
public ai(y var1) {
String var2 = "socket://" + var1.a + ':' + var1.b;
if (CoverageInfo.getCoverageStatus() == 0) {
EventLogger.logEvent(Main.a, "COVERAGE_NONE detected".getBytes(), 0);
}
try {
boolean var3 = WLANInfo.getWLANState() == 4620;
if (var3) {
var2 = var2 + ";interface=wifi";
} else if (CoverageInfo.isCoverageSufficient(1)) {
var2 = var2 + ";deviceside=true";
} else {
String var4 = this.f();
if (var4 != null) {
var2 = var2 + ";ConnectionUID=" + var4;
} else if (CoverageInfo.isCoverageSufficient(2)) {
var2 = var2 + ";deviceside=false";
} else {
var2 = "socket://" + var1.a + ':' + var1.b;
}
}
} catch (Exception var9) {
throw bh.d(1515804754, var2 + ", " + var9);
}
try {
EventLogger.logEvent(Main.a, ("trying " + var2).getBytes(), 0);
this.d = (SocketConnection)Connector.open(var2, 3, false);
} catch (ClassCastException var8) {
try {
EventLogger.logEvent(Main.a, "trying fallback".getBytes(), 0);
this.d = (SocketConnection)Connector.open("socket://" + var1.a + ':' + var1.b, 3, false);
} catch (ClassCastException var7) {
EventLogger.logEvent(Main.a, "Connect failed".getBytes(), 0);
throw bh.d(893539905, "Connect failed: " + var1);
}
}
try {
this.b = this.d.openDataInputStream();
} catch (IOException var6) {
this.a();
this.a = true;
bh.a((byte)1, 861296705, (Throwable)var6);
}
try {
this.c = this.d.openOutputStream();
} catch (IOException var5) {
this.a();
this.a = true;
bh.a((byte)1, 878072388, (Throwable)var5);
}
}
private String f() {
return null;
}
public void a() {
synchronized(this) {
if (this.c != null) {
try {
this.c.close();
} catch (IOException var32) {
bh.a((byte)1, 893864533, (Throwable)var32);
this.a = true;
} finally {
this.c = null;
}
}
if (this.b != null) {
try {
this.b.close();
} catch (IOException var30) {
bh.a((byte)1, 878265392, (Throwable)var30);
this.a = true;
} finally {
this.b = null;
}
}
if (this.d != null) {
try {
this.d.close();
} catch (IOException var28) {
bh.a((byte)1, 1496859442, (Throwable)var28);
this.a = true;
} finally {
this.d = null;
}
}
}
}
public DataInputStream b() {
synchronized(this) {
return this.b;
}
}
public OutputStream c() {
synchronized(this) {
return this.c;
}
}
public boolean d() {
synchronized(this) {
return this.d != null;
}
}
public boolean e() {
synchronized(this) {
return this.a;
}
}
}