コード例 #1
0
        public Result SubmitWork(Message message)
        {
            try
            {
                //get work
                return(server.SubmitWork(message));
            }
            catch (WebException webException)
            {
                if (RequireWorkFromAnotherMine(webException))
                {
                    //pick up another server and try again
                    UpdateServerWithPreferredMineAndCredential();
                }
                logger.Error("Abort GetWork on WebException for bot " + bot.Id + " at " + bot.IPAddress, webException);
            }
            catch (Exception exception)
            {
                logger.Error("Abort GetWork on Exception for bot " + bot.Id + " at " + bot.IPAddress, exception);
                return(new Result()
                {
                    HttpStatusCode = 404, DataText = "Server is offline.", Data = false
                });
            }

            return(new Result()
            {
                HttpStatusCode = 404, DataText = "All Servers are offline. (after 1 times check)", Data = false
            });
        }