Commit 8e9e45af48714de74a8aab6da2307da9b6eb3ce1

Authored by Matti Virkkunen
1 parent 4e72e62d

Force keep-alive for long polling. Stability improvements.

linehttptransport.cpp
... ... @@ -137,15 +137,15 @@ void LineHttpTransport::request(std::string method, std::string path, std::strin
137 137 }
138 138  
139 139 void LineHttpTransport::send_next() {
  140 + if (in_progress || request_queue.empty())
  141 + return;
  142 +
140 143 if (state != ConnectionState::CONNECTED) {
141 144 open();
142 145 return;
143 146 }
144 147  
145   - if (in_progress || request_queue.empty())
146   - return;
147   -
148   - keep_alive = false;
  148 + keep_alive = ls_mode;
149 149 status_code_ = -1;
150 150 content_length_ = -1;
151 151  
... ... @@ -264,8 +264,7 @@ void LineHttpTransport::ssl_read(gint, PurpleInputCondition) {
264 264 WRAPPER(LineHttpTransport::reconnect_timeout_cb),
265 265 (gpointer)this);
266 266 } else {
267   - conn->wants_to_die = TRUE;
268   - purple_connection_error(conn, "LINE: Could not connect to server.");
  267 + purple_connection_error(conn, "LINE: Lost connection to server.");
269 268 }
270 269 }
271 270  
... ... @@ -316,6 +315,8 @@ void LineHttpTransport::ssl_read(gint, PurpleInputCondition) {
316 315 msg = "LINE: This device was logged out via the mobile app.";
317 316 }
318 317  
  318 + // Don't try to reconnect so we don't fight over the session with another client
  319 +
319 320 conn->wants_to_die = TRUE;
320 321 }
321 322  
... ...
purpleline.cpp
... ... @@ -94,8 +94,7 @@ PurpleLine::PurpleLine(PurpleConnection *conn, PurpleAccount *acct) :
94 94 next_purple_id(1)
95 95 {
96 96 c_out = boost::make_shared<ThriftClient>(acct, conn, LINE_LOGIN_PATH);
97   -
98   -
  97 + os_http.set_auto_reconnect(true);
99 98 }
100 99  
101 100 PurpleLine::~PurpleLine() {
... ...