Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 57 lines (48 sloc) 1.675 kb
227b0f4d »
2012-01-19 Implement operation timeouts (CCBC-20)
1 /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /*
3 * Copyright 2012 Couchbase, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 #include "internal.h"
19
20 LIBCOUCHBASE_API
19a3e34a »
2012-08-23 Refactor the API
21 void lcb_set_timeout(lcb_t instance, lcb_uint32_t usec)
227b0f4d »
2012-01-19 Implement operation timeouts (CCBC-20)
22 {
23 instance->timeout.usec = usec;
24 }
25
26 LIBCOUCHBASE_API
19a3e34a »
2012-08-23 Refactor the API
27 lcb_uint32_t lcb_get_timeout(lcb_t instance)
227b0f4d »
2012-01-19 Implement operation timeouts (CCBC-20)
28 {
29 return instance->timeout.usec;
30 }
31
19a3e34a »
2012-08-23 Refactor the API
32 static void lcb_server_timeout_handler(lcb_socket_t sock,
33 short which,
34 void *arg)
227b0f4d »
2012-01-19 Implement operation timeouts (CCBC-20)
35 {
19a3e34a »
2012-08-23 Refactor the API
36 lcb_server_t *server = arg;
227b0f4d »
2012-01-19 Implement operation timeouts (CCBC-20)
37
19a3e34a »
2012-08-23 Refactor the API
38 lcb_purge_single_server(server, LCB_ETIMEDOUT);
39 lcb_update_server_timer(server);
40 lcb_maybe_breakout(server->instance);
227b0f4d »
2012-01-19 Implement operation timeouts (CCBC-20)
41
42 (void)sock;
43 (void)which;
44 }
45
19a3e34a »
2012-08-23 Refactor the API
46 void lcb_update_server_timer(lcb_server_t *server)
227b0f4d »
2012-01-19 Implement operation timeouts (CCBC-20)
47 {
19a3e34a »
2012-08-23 Refactor the API
48 lcb_t instance = server->instance;
227b0f4d »
2012-01-19 Implement operation timeouts (CCBC-20)
49
121e219e »
2012-07-26 Bind timeouts to server sockets instead of commands
50 if (server->timer) {
51 instance->io->delete_timer(instance->io, server->timer);
227b0f4d »
2012-01-19 Implement operation timeouts (CCBC-20)
52 }
121e219e »
2012-07-26 Bind timeouts to server sockets instead of commands
53 instance->io->update_timer(instance->io, server->timer,
54 instance->timeout.usec, server,
19a3e34a »
2012-08-23 Refactor the API
55 lcb_server_timeout_handler);
227b0f4d »
2012-01-19 Implement operation timeouts (CCBC-20)
56 }
Something went wrong with that request. Please try again.