• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 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"""Listen on socket until a datagram is received.
6
7This is used for testing leasing.
8"""
9
10from __future__ import absolute_import
11from __future__ import division
12from __future__ import print_function
13
14import logging
15import socket
16import sys
17
18from lucifer import loglib
19
20logger = logging.getLogger(__name__)
21
22
23def main(_args):
24    """Main function
25
26    @param args: list of command line args
27    """
28    loglib.configure_logging(name='abort_socket')
29    sock = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
30    sock.bind(sys.argv[1])
31    print('done')
32    sock.recv(1)
33
34
35if __name__ == '__main__':
36    sys.exit(main(sys.argv[1:]))
37