<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def shutdown(self, reason = ConnectionClosed()):
 """Shutdown the socket server. The socket server will stop accepting incoming connections. All connections will be dropped. """

        if self._shutdown:
            raise ShutdownError()
        
        self.stop()
       
        self._closing = True
        for connection in self.connections:
            connection.close()
        self.connections = set()
        self._shutdown = True
        if isinstance(reason, ConnectionClosed):
            logger.info("server shutdown")
        else:
            logger.warn("server shutdown, reason %s" % str(reason))