blob: 46b3d9e68614c1a8998bc7f3c14131cd2f51bb0e [file] [log] [blame]
Ryan Keanedeb48b32019-06-28 16:24:40 -07001// Copyright 2019 The Chromium 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 "platform/api/udp_socket.h"
6
Ryan Keanea4dfaa12019-08-19 10:30:20 -07007#include "platform/api/task_runner.h"
8
Ryan Keanedeb48b32019-06-28 16:24:40 -07009namespace openscreen {
10namespace platform {
11
Ryan Keanea4dfaa12019-08-19 10:30:20 -070012UdpSocket::UdpSocket(TaskRunner* task_runner, Client* client)
13 : client_(client), task_runner_(task_runner) {
14 OSP_CHECK(task_runner_);
Ryan Keanedeb48b32019-06-28 16:24:40 -070015 deletion_callback_ = [](UdpSocket* socket) {};
16}
17
18UdpSocket::~UdpSocket() {
19 deletion_callback_(this);
20}
21
22void UdpSocket::SetDeletionCallback(std::function<void(UdpSocket*)> callback) {
23 deletion_callback_ = callback;
24}
25
26} // namespace platform
27} // namespace openscreen