~ubuntu-branches/ubuntu/trusty/jruby/trusty-proposed

« back to all changes in this revision

Viewing changes to src/org/jruby/ext/socket/RubyBasicSocket.java

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Delafond
  • Date: 2009-12-10 12:34:42 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20091210123442-df7t1v36qtfkj5df
Tags: 1.4.0-1
* New upstream release.
* Updated watch file.
* Updated copyright file to reflect addition of new third-party jars.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
import java.net.DatagramSocket;
44
44
import java.net.SocketAddress;
45
45
import java.net.InetSocketAddress;
 
46
import org.jruby.CompatVersion;
46
47
import org.jruby.util.io.OpenFile;
47
48
import org.jruby.Ruby;
48
49
import org.jruby.RubyBoolean;
77
78
        rb_cBasicSocket.defineAnnotatedMethods(RubyBasicSocket.class);
78
79
    }
79
80
 
 
81
    // By default we always reverse lookup unless do_not_reverse_lookup set.
 
82
    private boolean doNotReverseLookup = false;
 
83
 
80
84
    public RubyBasicSocket(Ruby runtime, RubyClass type) {
81
85
        super(runtime, type);
82
86
    }
601
605
        return close();
602
606
    }
603
607
 
 
608
    protected boolean doNotReverseLookup(ThreadContext context) {
 
609
        return context.getRuntime().isDoNotReverseLookupEnabled() || doNotReverseLookup;
 
610
    }
 
611
 
 
612
    @JRubyMethod(compat = CompatVersion.RUBY1_9)
 
613
    public IRubyObject do_not_reverse_lookup19(ThreadContext context) {
 
614
        return context.getRuntime().newBoolean(doNotReverseLookup);
 
615
    }
 
616
 
 
617
    @JRubyMethod(name = "do_not_reverse_lookup=", compat = CompatVersion.RUBY1_9)
 
618
    public IRubyObject set_do_not_reverse_lookup19(ThreadContext context, IRubyObject flag) {
 
619
        doNotReverseLookup = flag.isTrue();
 
620
        return do_not_reverse_lookup19(context);
 
621
    }
 
622
 
604
623
    @JRubyMethod(meta = true)
605
624
    public static IRubyObject do_not_reverse_lookup(IRubyObject recv) {
606
625
        return recv.getRuntime().isDoNotReverseLookupEnabled() ? recv.getRuntime().getTrue() : recv.getRuntime().getFalse();