MCPcopy Create free account
hub / github.com/dborth/fceugx / InitializeNetwork

Function InitializeNetwork

source/networkop.cpp:144–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142#endif
143
144bool InitializeNetwork(bool silent)
145{
146#ifdef HW_RVL
147 StopNetworkThread();
148
149 if(networkInit && net_gethostip() > 0)
150 return true;
151
152 networkInit = false;
153#else
154 if(networkInit)
155 return true;
156#endif
157
158 int retry = 1;
159
160 while(retry)
161 {
162 ShowAction("Initializing network...");
163
164#ifdef HW_RVL
165 u64 start = gettime();
166 StartNetworkThread();
167
168 while (!LWP_ThreadIsSuspended(networkthread))
169 {
170 usleep(50 * 1000);
171
172 if(diff_sec(start, gettime()) > 10) // wait for 10 seconds max for net init
173 break;
174 }
175#else
176 networkInit = !(if_config(wiiIP, NULL, NULL, true) < 0);
177#endif
178
179 CancelAction();
180
181 if(networkInit || silent)
182 break;
183
184 retry = ErrorPromptRetry("Unable to initialize network!");
185#ifdef HW_RVL
186 if(networkInit && net_gethostip() > 0)
187#else
188 if(networkInit)
189#endif
190 return true;
191 }
192 return networkInit;
193}
194
195void CloseShare()
196{

Callers 1

ConnectShareFunction · 0.85

Calls 5

StopNetworkThreadFunction · 0.85
ShowActionFunction · 0.85
StartNetworkThreadFunction · 0.85
CancelActionFunction · 0.85
ErrorPromptRetryFunction · 0.85

Tested by

no test coverage detected