libcouchbase 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2b2adec3e51e4e60b6c916abc6ec9b3ab4fabe8
|
4
|
+
data.tar.gz: 2ab400fc7fa882756081614ca99db819e7c04534
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01eedef8aeeedebdcd998a40542023d7fe50e0121f5848ca4635b38af977ff8f512e2f002fb092216787b831bc80c834dd15ed743b777c9ea2bfd4904a604eeb
|
7
|
+
data.tar.gz: 310f7f69fb77f03b50c9f6f626a9b76cf9ce9913e69471d9a4629e06eedd53af2b548e04740dc2ac1ce398371a077fd7a3eadf148e65539e2d97f30174c6a708
|
@@ -232,6 +232,7 @@ static lcb_sockdata_t *create_socket(lcb_io_opt_t iobase,
|
|
232
232
|
}
|
233
233
|
|
234
234
|
uv_tcp_init(io->loop, &ret->tcp.t);
|
235
|
+
ret->base.socket = INVALID_SOCKET;
|
235
236
|
|
236
237
|
incref_iops(io);
|
237
238
|
incref_sock(ret);
|
@@ -328,6 +329,7 @@ static int start_connect(lcb_io_opt_t iobase,
|
|
328
329
|
my_uvreq_t *uvr;
|
329
330
|
int ret;
|
330
331
|
int err_is_set = 0;
|
332
|
+
uv_os_fd_t fd = INVALID_SOCKET;
|
331
333
|
|
332
334
|
uvr = alloc_uvreq(sock, (generic_callback_t)callback);
|
333
335
|
if (!uvr) {
|
@@ -363,6 +365,13 @@ static int start_connect(lcb_io_opt_t iobase,
|
|
363
365
|
incref_sock(sock);
|
364
366
|
}
|
365
367
|
|
368
|
+
/* Fetch socket descriptor for internal usage.
|
369
|
+
* For example to detect dead sockets. */
|
370
|
+
ret = uv_fileno((uv_handle_t *)&sock->tcp, &fd);
|
371
|
+
if (ret == 0) {
|
372
|
+
sock->base.socket = fd;
|
373
|
+
}
|
374
|
+
|
366
375
|
return ret;
|
367
376
|
}
|
368
377
|
|
@@ -610,6 +619,48 @@ static void set_last_error(my_iops_t *io, int error)
|
|
610
619
|
io->base.v.v1.error = uvc_last_errno(io->loop, error);
|
611
620
|
}
|
612
621
|
|
622
|
+
static int check_closed(lcb_io_opt_t io, lcb_sockdata_t *sockbase, int flags)
|
623
|
+
{
|
624
|
+
my_sockdata_t *sd = (my_sockdata_t *)sockbase;
|
625
|
+
|
626
|
+
char buf = 0;
|
627
|
+
int rv = 0;
|
628
|
+
lcb_socket_t sock = sd->base.socket;
|
629
|
+
|
630
|
+
if (sock == INVALID_SOCKET) {
|
631
|
+
return LCB_IO_SOCKCHECK_STATUS_UNKNOWN;
|
632
|
+
}
|
633
|
+
|
634
|
+
GT_RETRY:
|
635
|
+
/* We can ignore flags for now, since both Windows and POSIX support MSG_PEEK */
|
636
|
+
rv = recv(sock, &buf, 1, MSG_PEEK);
|
637
|
+
if (rv == 1) {
|
638
|
+
if (flags & LCB_IO_SOCKCHECK_PEND_IS_ERROR) {
|
639
|
+
return LCB_IO_SOCKCHECK_STATUS_CLOSED;
|
640
|
+
} else {
|
641
|
+
return LCB_IO_SOCKCHECK_STATUS_OK;
|
642
|
+
}
|
643
|
+
} else if (rv == 0) {
|
644
|
+
/* Really closed! */
|
645
|
+
return LCB_IO_SOCKCHECK_STATUS_CLOSED;
|
646
|
+
} else {
|
647
|
+
int last_err;
|
648
|
+
#ifdef _WIN32
|
649
|
+
last_err = get_wserr(sock);
|
650
|
+
#else
|
651
|
+
last_err = errno;
|
652
|
+
#endif
|
653
|
+
|
654
|
+
if (last_err == EINTR) {
|
655
|
+
goto GT_RETRY;
|
656
|
+
} else if (last_err == EWOULDBLOCK || last_err == EAGAIN) {
|
657
|
+
return LCB_IO_SOCKCHECK_STATUS_OK; /* Nothing to report. So we're good */
|
658
|
+
} else {
|
659
|
+
return LCB_IO_SOCKCHECK_STATUS_CLOSED;
|
660
|
+
}
|
661
|
+
}
|
662
|
+
}
|
663
|
+
|
613
664
|
static void wire_iops2(int version,
|
614
665
|
lcb_loop_procs *loop,
|
615
666
|
lcb_timer_procs *timer,
|
@@ -635,6 +686,7 @@ static void wire_iops2(int version,
|
|
635
686
|
iocp->read2 = start_read;
|
636
687
|
iocp->write2 = start_write2;
|
637
688
|
iocp->cntl = cntl_socket;
|
689
|
+
iocp->is_closed = check_closed;
|
638
690
|
|
639
691
|
/** Stuff we don't use */
|
640
692
|
iocp->write = NULL;
|
@@ -42,25 +42,6 @@ TEST_F(SockMgrTest, testCancellation)
|
|
42
42
|
// See if a connection closed when it was idle is returned or not!
|
43
43
|
TEST_F(SockMgrTest, testIdleClosed)
|
44
44
|
{
|
45
|
-
struct lcb_cntl_iops_info_st info = { 0 };
|
46
|
-
lcb_error_t err = lcb_cntl(NULL,
|
47
|
-
LCB_CNTL_GET, LCB_CNTL_IOPS_DEFAULT_TYPES, &info);
|
48
|
-
|
49
|
-
ASSERT_EQ(LCB_SUCCESS, err);
|
50
|
-
switch (info.v.v0.effective) {
|
51
|
-
case LCB_IO_OPS_SELECT:
|
52
|
-
case LCB_IO_OPS_LIBEV:
|
53
|
-
case LCB_IO_OPS_LIBEVENT:
|
54
|
-
case LCB_IO_OPS_WINIOCP:
|
55
|
-
break;
|
56
|
-
|
57
|
-
case LCB_IO_OPS_LIBUV:
|
58
|
-
default:
|
59
|
-
fprintf(stderr, "SockMgrTest::testIdleClosed: IOPS Type=0x%x does not have a known check_closed. Skipping\n", info.v.v0.effective);
|
60
|
-
return;
|
61
|
-
}
|
62
|
-
|
63
|
-
|
64
45
|
lcb_socket_t llfd;
|
65
46
|
ESocket *sock1 = new ESocket();
|
66
47
|
loop->connectPooled(sock1);
|
data/lib/libcouchbase/bucket.rb
CHANGED
@@ -571,11 +571,17 @@ module Libcouchbase
|
|
571
571
|
id ||= attrs.delete(:_id)
|
572
572
|
id = id.to_s.sub(/^_design\//, '')
|
573
573
|
|
574
|
-
|
574
|
+
prom = @connection.http("/_design/#{id}",
|
575
575
|
method: :put,
|
576
576
|
body: attrs,
|
577
577
|
type: :view
|
578
|
-
)
|
578
|
+
).then { |res|
|
579
|
+
# Seems to require a moment before the view is usable
|
580
|
+
@reactor.sleep 100
|
581
|
+
res
|
582
|
+
}
|
583
|
+
|
584
|
+
result prom, async
|
579
585
|
end
|
580
586
|
|
581
587
|
# Delete design doc with given id and optional revision.
|
data/lib/libcouchbase/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libcouchbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen von Takach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|