MCPcopy Create free account
hub / github.com/DFHack/dfhack / flush_proxy

Method flush_proxy

library/RemoteServer.cpp:220–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220void ServerConnection::connection_ostream::flush_proxy()
221{
222 if (owner->in_error)
223 {
224 buffer.clear();
225 return;
226 }
227
228 if (buffer.empty())
229 return;
230
231 CoreTextNotification msg;
232
233 for (auto it = buffer.begin(); it != buffer.end(); ++it)
234 {
235 auto frag = msg.add_fragments();
236 frag->set_text(it->second);
237 if (it->first >= 0)
238 frag->set_color(CoreTextFragment::Color(it->first));
239 }
240
241 buffer.clear();
242
243 if (!sendRemoteMessage(owner->socket, RPC_REPLY_TEXT, &msg, false))
244 {
245 owner->in_error = true;
246 Core::printerr("Error writing text into client socket.\n");
247 }
248}
249
250void ServerConnection::Accepted(CActiveSocket* socket)
251{

Callers

nothing calls this directly

Calls 6

sendRemoteMessageFunction · 0.85
printerrFunction · 0.50
clearMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected