~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/server.py

  • Committer: Aaron Bentley
  • Date: 2008-04-24 04:58:42 UTC
  • mfrom: (3377 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3380.
  • Revision ID: aaron@aaronbentley.com-20080424045842-0cajl9v6s4u52kaw
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
 
19
19
import errno
20
20
import socket
 
21
import sys
21
22
import threading
22
23
 
23
24
from bzrlib.hooks import Hooks
59
60
        self._socket_error = socket_error
60
61
        self._socket_timeout = socket_timeout
61
62
        self._server_socket = socket.socket()
 
63
        # SO_REUSERADDR has a different meaning on Windows
 
64
        if sys.platform != 'win32':
 
65
            self._server_socket.setsockopt(socket.SOL_SOCKET,
 
66
                socket.SO_REUSEADDR, 1)
62
67
        self._server_socket.bind((host, port))
63
68
        self._sockname = self._server_socket.getsockname()
64
69
        self.port = self._sockname[1]