public static interface SocketDescriptorInterface {
long send_data(byte[] data, boolean resume_read);
void disconnect_socket();
- boolean eq(long other_arg);
+ boolean eq(SocketDescriptor other_arg);
long hash();
}
- public SocketDescriptor(SocketDescriptorInterface arg) {
- this(new bindings.LDKSocketDescriptor() {
+ private static class LDKSocketDescriptorHolder { SocketDescriptor held; }
+ public static SocketDescriptor new_impl(SocketDescriptorInterface arg) {
+ final LDKSocketDescriptorHolder impl_holder = new LDKSocketDescriptorHolder();
+ impl_holder.held = new SocketDescriptor(new bindings.LDKSocketDescriptor() {
@Override public long send_data(byte[] data, boolean resume_read) {
long ret = arg.send_data(data, resume_read);
return ret;
arg.disconnect_socket();
}
@Override public boolean eq(long other_arg) {
- boolean ret = arg.eq(other_arg);
+ SocketDescriptor ret_hu_conv = new SocketDescriptor(null, other_arg);
+ ret_hu_conv.ptrs_to.add(this);
+ boolean ret = arg.eq(ret_hu_conv);
return ret;
}
@Override public long hash() {
return ret;
}
});
+ return impl_holder.held;
}
public long send_data(byte[] data, boolean resume_read) {
long ret = bindings.SocketDescriptor_send_data(this.ptr, data, resume_read);
return ret;
}
+ public static SocketDescriptor constructor_clone(SocketDescriptor orig) {
+ long ret = bindings.SocketDescriptor_clone(orig == null ? 0 : orig.ptr);
+ SocketDescriptor ret_hu_conv = new SocketDescriptor(null, ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ ret_hu_conv.ptrs_to.add(orig);
+ return ret_hu_conv;
+ }
+
}