Andreea Costinas | e45d54b | 2020-03-10 09:21:14 +0100 | [diff] [blame] | 1 | // Copyright 2020 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "system-proxy/curl_socket.h" |
| 6 | |
| 7 | #include <memory> |
| 8 | #include <utility> |
| 9 | |
| 10 | namespace system_proxy { |
| 11 | |
| 12 | CurlSocket::CurlSocket(base::ScopedFD fd, ScopedCurlEasyhandle curl_easyhandle) |
Garrick Evans | 3388a03 | 2020-03-24 11:25:55 +0900 | [diff] [blame^] | 13 | : patchpanel::Socket(std::move(fd)), |
Andreea Costinas | e45d54b | 2020-03-10 09:21:14 +0100 | [diff] [blame] | 14 | curl_easyhandle_(std::move(curl_easyhandle)) {} |
| 15 | |
Andreea Costinas | 1241496 | 2020-04-12 21:59:29 +0200 | [diff] [blame] | 16 | CurlSocket::~CurlSocket() { |
| 17 | // TODO(acostinas,https://crbug.com/1070732) Allow SocketForwarder creation |
| 18 | // with raw sockets and defer closing the socket to libcurl via a callback |
| 19 | // instead of releaing the socket in the destructor. |
| 20 | int fd = release(); |
| 21 | VLOG(1) << "Released " << fd << " to be closed by the curl handler"; |
| 22 | } |
Andreea Costinas | e45d54b | 2020-03-10 09:21:14 +0100 | [diff] [blame] | 23 | |
| 24 | } // namespace system_proxy |