Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/06/10 01:56:04 (13 years ago)
Author:
swagner
Message:

Merged cloning refactoring branch back into trunk (#922)

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/Drivers/EvaluationTCPChannel.cs

    r3895 r4722  
    5858    private Socket socket;
    5959
     60    [StorableConstructor]
     61    protected EvaluationTCPChannel(bool deserializing) : base(deserializing) { }
     62    protected EvaluationTCPChannel(EvaluationTCPChannel original, Cloner cloner)
     63      : base(original, cloner) {
     64      ipAddress = original.ipAddress;
     65      port = original.port;
     66    }
     67    public override IDeepCloneable Clone(Cloner cloner) {
     68      return new EvaluationTCPChannel(this, cloner);
     69    }
     70
    6071    public EvaluationTCPChannel() : this(String.Empty, 0) { }
    6172    public EvaluationTCPChannel(string ip, int port)
     
    6374      this.ipAddress = ip;
    6475      this.port = port;
    65     }
    66 
    67     public override IDeepCloneable Clone(Cloner cloner) {
    68       EvaluationTCPChannel clone = (EvaluationTCPChannel)base.Clone(cloner);
    69       clone.ipAddress = ipAddress;
    70       clone.port = port;
    71       return clone;
    7276    }
    7377
     
    8791        byte[] buffer = EncodeDelimited(message);
    8892        socket.Send(buffer);
    89       } catch (SocketException) {
    90         Close();
    91         throw;
    92       } catch (ObjectDisposedException) {
     93      }
     94      catch (SocketException) {
     95        Close();
     96        throw;
     97      }
     98      catch (ObjectDisposedException) {
    9399        socket = null;
    94100        Close();
     
    122128        byte[] buffer = GetMessageBuffer();
    123129        return builder.WeakMergeFrom(ByteString.CopyFrom(buffer)).WeakBuild();
    124       } catch (SocketException) {
    125         Close();
    126         throw;
    127       } catch (ObjectDisposedException) {
     130      }
     131      catch (SocketException) {
     132        Close();
     133        throw;
     134      }
     135      catch (ObjectDisposedException) {
    128136        socket = null;
    129137        Close();
     
    164172            socket.Disconnect(false);
    165173          socket.Close();
    166         } catch { }
     174        }
     175        catch { }
    167176        socket = null;
    168177      }
Note: See TracChangeset for help on using the changeset viewer.