Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1264)

Side by Side Diff: remoting/protocol/ssl_hmac_channel_authenticator.cc

Issue 551173004: Move PseudoTCP and channel auth out of LibjingleTransportFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clean_dgrams
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/protocol/ssl_hmac_channel_authenticator.h" 5 #include "remoting/protocol/ssl_hmac_channel_authenticator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "crypto/secure_util.h" 9 #include "crypto/secure_util.h"
10 #include "net/base/host_port_pair.h" 10 #include "net/base/host_port_pair.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 272
273 return crypto::SecureMemEqual(received_auth_bytes.data(), 273 return crypto::SecureMemEqual(received_auth_bytes.data(),
274 &(auth_bytes[0]), kAuthDigestLength); 274 &(auth_bytes[0]), kAuthDigestLength);
275 } 275 }
276 276
277 void SslHmacChannelAuthenticator::CheckDone(bool* callback_called) { 277 void SslHmacChannelAuthenticator::CheckDone(bool* callback_called) {
278 if (auth_write_buf_.get() == NULL && auth_read_buf_.get() == NULL) { 278 if (auth_write_buf_.get() == NULL && auth_read_buf_.get() == NULL) {
279 DCHECK(socket_.get() != NULL); 279 DCHECK(socket_.get() != NULL);
280 if (callback_called) 280 if (callback_called)
281 *callback_called = true; 281 *callback_called = true;
282 done_callback_.Run(net::OK, socket_.PassAs<net::StreamSocket>()); 282
283 NotifyResult(net::OK, socket_.PassAs<net::StreamSocket>());
283 } 284 }
284 } 285 }
285 286
286 void SslHmacChannelAuthenticator::NotifyError(int error) { 287 void SslHmacChannelAuthenticator::NotifyError(int error) {
287 done_callback_.Run(static_cast<net::Error>(error), 288 NotifyResult(static_cast<net::Error>(error), scoped_ptr<net::StreamSocket>());
Wez 2014/09/10 02:29:27 This has undefined and potentially scary behaviour
Sergey Ulanov 2014/09/10 21:50:59 We will still need to convert int to net::Error be
288 scoped_ptr<net::StreamSocket>()); 289 }
290
291 void SslHmacChannelAuthenticator::NotifyResult(
292 net::Error error,
293 scoped_ptr<net::StreamSocket> socket) {
294 DoneCallback callback = done_callback_;
295 done_callback_.Reset();
296 callback.Run(error, socket.Pass());
289 } 297 }
290 298
291 } // namespace protocol 299 } // namespace protocol
292 } // namespace remoting 300 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698