M000253.html

tmud-2.10.0/doc/classes/Connection.src/M000253.html · 2.5 KB

From the archive tmud-2.10.0.tar.gz

Download the archive   « Back to the archive contents

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
  <title>update (Connection)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
  <pre><span class="ruby-comment cmt"># File lib/network/connection.rb, line 178</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>(<span class="ruby-identifier">msg</span>)
    <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">msg</span>
    <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:quit</span>
      <span class="ruby-identifier">handle_output</span>
      <span class="ruby-ivar">@closing</span> = <span class="ruby-keyword kw">true</span>
    <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:reconnecting</span>
      <span class="ruby-identifier">unsubscribe_all</span>
      <span class="ruby-identifier">log</span>.<span class="ruby-identifier">info</span> <span class="ruby-node">&quot;(#{self.object_id}) Connection '#{@host}(#{@addr})' closing for reconnection&quot;</span>
      <span class="ruby-ivar">@server</span>.<span class="ruby-identifier">unregister</span>(<span class="ruby-keyword kw">self</span>)
  <span class="ruby-comment cmt">#    @sock.shutdown   # odd errors thrown with this</span>
      <span class="ruby-ivar">@sock</span>.<span class="ruby-identifier">close</span>
    <span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span>
      <span class="ruby-identifier">sendmsg</span>(<span class="ruby-identifier">msg</span>)
    <span class="ruby-keyword kw">else</span>
      <span class="ruby-identifier">log</span>.<span class="ruby-identifier">error</span> <span class="ruby-node">&quot;(#{self.object_id}) Connection#update - unknown message '#{@msg.inspect}'&quot;</span>
    <span class="ruby-keyword kw">end</span>
  <span class="ruby-keyword kw">rescue</span>
    <span class="ruby-comment cmt"># We squash and print out all exceptions here.  There is no reason to</span>
    <span class="ruby-comment cmt"># throw these back at out subscribers.</span>
    <span class="ruby-identifier">log</span>.<span class="ruby-identifier">error</span> <span class="ruby-identifier">$!</span>
  <span class="ruby-keyword kw">end</span></pre>
</body>
</html>

Site Stats

Snippets: 1791
Codebases: 571