OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/sync/engine/net/server_connection_manager.h" | 5 #include "chrome/browser/sync/engine/net/server_connection_manager.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 | 8 |
9 #include <ostream> | 9 #include <ostream> |
10 #include <string> | 10 #include <string> |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 ServerConnectionManager* const conn_mgr_; | 136 ServerConnectionManager* const conn_mgr_; |
137 HttpResponse* const response_; | 137 HttpResponse* const response_; |
138 // TODO(timsteele): Should this be Barrier:AtomicIncrement? | 138 // TODO(timsteele): Should this be Barrier:AtomicIncrement? |
139 base::subtle::AtomicWord reset_count_; | 139 base::subtle::AtomicWord reset_count_; |
140 bool server_reachable_; | 140 bool server_reachable_; |
141 }; | 141 }; |
142 | 142 |
143 ServerConnectionManager::ServerConnectionManager( | 143 ServerConnectionManager::ServerConnectionManager( |
144 const string& server, int port, bool use_ssl, const string& user_agent, | 144 const string& server, int port, bool use_ssl, const string& user_agent, |
145 const string& client_id) | 145 const string& client_id) |
146 : sync_server_(server), sync_server_port_(port), | 146 : sync_server_(server), |
| 147 sync_server_port_(port), |
| 148 client_id_(client_id), |
| 149 user_agent_(user_agent), |
| 150 use_ssl_(use_ssl), |
| 151 proto_sync_path_(kSyncServerSyncPath), |
| 152 get_time_path_(kSyncServerGetTimePath), |
| 153 error_count_(0), |
147 channel_(new Channel(shutdown_event)), | 154 channel_(new Channel(shutdown_event)), |
148 server_status_(HttpResponse::NONE), server_reachable_(false), | 155 server_status_(HttpResponse::NONE), |
149 client_id_(client_id), use_ssl_(use_ssl), | 156 server_reachable_(false), |
150 user_agent_(user_agent), | |
151 platform_(new PlatformMembers(user_agent)), | 157 platform_(new PlatformMembers(user_agent)), |
152 reset_count_(0), error_count_(0), | 158 reset_count_(0), |
153 terminate_all_io_(false), | 159 terminate_all_io_(false) { |
154 proto_sync_path_(kSyncServerSyncPath), | |
155 get_time_path_(kSyncServerGetTimePath) { | |
156 } | 160 } |
157 | 161 |
158 ServerConnectionManager::~ServerConnectionManager() { | 162 ServerConnectionManager::~ServerConnectionManager() { |
159 delete channel_; | 163 delete channel_; |
160 delete platform_; | 164 delete platform_; |
161 shutdown_event_mutex_.Lock(); | 165 shutdown_event_mutex_.Lock(); |
162 int result = pthread_cond_broadcast(&shutdown_event_condition_.condvar_); | 166 int result = pthread_cond_broadcast(&shutdown_event_condition_.condvar_); |
163 shutdown_event_mutex_.Unlock(); | 167 shutdown_event_mutex_.Unlock(); |
164 if (result) { | 168 if (result) { |
165 LOG(ERROR) << "Error signaling shutdown_event_condition_ last error = " | 169 LOG(ERROR) << "Error signaling shutdown_event_condition_ last error = " |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 374 |
371 } // namespace browser_sync | 375 } // namespace browser_sync |
372 | 376 |
373 std::ostream& operator << (std::ostream& s, | 377 std::ostream& operator << (std::ostream& s, |
374 const struct browser_sync::HttpResponse& hr) { | 378 const struct browser_sync::HttpResponse& hr) { |
375 s << " Response Code (bogus on error): " << hr.response_code; | 379 s << " Response Code (bogus on error): " << hr.response_code; |
376 s << " Content-Length (bogus on error): " << hr.content_length; | 380 s << " Content-Length (bogus on error): " << hr.content_length; |
377 s << " Server Status: " << hr.server_status; | 381 s << " Server Status: " << hr.server_status; |
378 return s; | 382 return s; |
379 } | 383 } |
OLD | NEW |