Skip to content

Commit 47e2edf

Browse files
author
Christian Hergert
committed
stream: make mongoc_stream_t public.
This also removes the cork/uncork variants.
1 parent 46b4276 commit 47e2edf

File tree

9 files changed

+26
-179
lines changed

9 files changed

+26
-179
lines changed

build/autotools/Versions.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ m4_define([mongoc_version], [mongoc_major_version.mongoc_minor_version.mongoc_mi
55

66
# bump up by 1 for every micro release with no API changes, otherwise
77
# set to 0. after release, bump up by 1
8-
m4_define([mongoc_interface_age], [5])
8+
m4_define([mongoc_interface_age], [0])
99
m4_define([mongoc_binary_age], [m4_eval(100 * mongoc_minor_version + mongoc_micro_version)])
1010

1111
m4_define([lt_current], [m4_eval(100 * mongoc_minor_version + mongoc_micro_version - mongoc_interface_age)])

build/cmake/libmongoc-ssl.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ mongoc_socket_sendv
153153
mongoc_socket_setsockopt
154154
mongoc_stream_buffered_new
155155
mongoc_stream_close
156-
mongoc_stream_cork
157156
mongoc_stream_destroy
158157
mongoc_stream_file_get_fd
159158
mongoc_stream_file_new
@@ -169,7 +168,6 @@ mongoc_stream_socket_new
169168
mongoc_stream_tls_check_cert
170169
mongoc_stream_tls_do_handshake
171170
mongoc_stream_tls_new
172-
mongoc_stream_uncork
173171
mongoc_stream_writev
174172
mongoc_uri_copy
175173
mongoc_uri_destroy

build/cmake/libmongoc.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ mongoc_socket_sendv
152152
mongoc_socket_setsockopt
153153
mongoc_stream_buffered_new
154154
mongoc_stream_close
155-
mongoc_stream_cork
156155
mongoc_stream_destroy
157156
mongoc_stream_file_get_fd
158157
mongoc_stream_file_new
@@ -165,7 +164,6 @@ mongoc_stream_readv
165164
mongoc_stream_setsockopt
166165
mongoc_stream_socket_get_socket
167166
mongoc_stream_socket_new
168-
mongoc_stream_uncork
169167
mongoc_stream_writev
170168
mongoc_uri_copy
171169
mongoc_uri_destroy

src/libmongoc.symbols

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ mongoc_socket_setsockopt
157157
mongoc_ssl_opt_get_default
158158
mongoc_stream_buffered_new
159159
mongoc_stream_close
160-
mongoc_stream_cork
161160
mongoc_stream_destroy
162161
mongoc_stream_file_get_fd
163162
mongoc_stream_file_new
@@ -173,7 +172,6 @@ mongoc_stream_socket_new
173172
mongoc_stream_tls_check_cert
174173
mongoc_stream_tls_do_handshake
175174
mongoc_stream_tls_new
176-
mongoc_stream_uncork
177175
mongoc_stream_writev
178176
mongoc_uri_copy
179177
mongoc_uri_destroy

src/mongoc/mongoc-stream-buffered.c

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -237,56 +237,6 @@ mongoc_stream_buffered_readv (mongoc_stream_t *stream, /* IN */
237237
}
238238

239239

240-
/*
241-
*--------------------------------------------------------------------------
242-
*
243-
* mongoc_stream_buffered_cork --
244-
*
245-
* Cork the underlying stream.
246-
*
247-
* Returns:
248-
* 0 on success; -1 on failure and errno is set.
249-
*
250-
* Side effects:
251-
* None.
252-
*
253-
*--------------------------------------------------------------------------
254-
*/
255-
256-
static int
257-
mongoc_stream_buffered_cork (mongoc_stream_t *stream) /* IN */
258-
{
259-
mongoc_stream_buffered_t *buffered = (mongoc_stream_buffered_t *)stream;
260-
bson_return_val_if_fail(stream, -1);
261-
return mongoc_stream_cork(buffered->base_stream);
262-
}
263-
264-
265-
/*
266-
*--------------------------------------------------------------------------
267-
*
268-
* mongoc_stream_buffered_uncork --
269-
*
270-
* Uncork the underlying stream.
271-
*
272-
* Returns:
273-
* 0 on success; -1 on failure and errno is set.
274-
*
275-
* Side effects:
276-
* None.
277-
*
278-
*--------------------------------------------------------------------------
279-
*/
280-
281-
static int
282-
mongoc_stream_buffered_uncork (mongoc_stream_t *stream) /* IN */
283-
{
284-
mongoc_stream_buffered_t *buffered = (mongoc_stream_buffered_t *)stream;
285-
bson_return_val_if_fail(stream, -1);
286-
return mongoc_stream_uncork(buffered->base_stream);
287-
}
288-
289-
290240
static mongoc_stream_t *
291241
_mongoc_stream_buffered_get_base_stream (mongoc_stream_t *stream) /* IN */
292242
{
@@ -332,8 +282,6 @@ mongoc_stream_buffered_new (mongoc_stream_t *base_stream, /* IN */
332282
stream->stream.flush = mongoc_stream_buffered_flush;
333283
stream->stream.writev = mongoc_stream_buffered_writev;
334284
stream->stream.readv = mongoc_stream_buffered_readv;
335-
stream->stream.cork = mongoc_stream_buffered_cork;
336-
stream->stream.uncork = mongoc_stream_buffered_uncork;
337285
stream->stream.get_base_stream = _mongoc_stream_buffered_get_base_stream;
338286

339287
stream->base_stream = base_stream;

src/mongoc/mongoc-stream-private.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -33,33 +33,6 @@ BSON_BEGIN_DECLS
3333
#define MONGOC_STREAM_TLS 5
3434

3535

36-
struct _mongoc_stream_t
37-
{
38-
int type;
39-
void (*destroy) (mongoc_stream_t *stream);
40-
int (*close) (mongoc_stream_t *stream);
41-
int (*flush) (mongoc_stream_t *stream);
42-
ssize_t (*writev) (mongoc_stream_t *stream,
43-
mongoc_iovec_t *iov,
44-
size_t iovcnt,
45-
int32_t timeout_msec);
46-
ssize_t (*readv) (mongoc_stream_t *stream,
47-
mongoc_iovec_t *iov,
48-
size_t iovcnt,
49-
size_t min_bytes,
50-
int32_t timeout_msec);
51-
int (*cork) (mongoc_stream_t *stream);
52-
int (*uncork) (mongoc_stream_t *stream);
53-
int (*setsockopt) (mongoc_stream_t *stream,
54-
int level,
55-
int optname,
56-
void *optval,
57-
socklen_t optlen);
58-
mongoc_stream_t *(*get_base_stream) (mongoc_stream_t *stream);
59-
60-
};
61-
62-
6336
BSON_END_DECLS
6437

6538

src/mongoc/mongoc-stream-tls.c

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -625,60 +625,6 @@ _mongoc_stream_tls_readv (mongoc_stream_t *stream,
625625
}
626626

627627

628-
/*
629-
*--------------------------------------------------------------------------
630-
*
631-
* _mongoc_stream_tls_cork --
632-
*
633-
* This function is not supported on mongoc_stream_tls_t.
634-
*
635-
* Returns:
636-
* 0 always.
637-
*
638-
* Side effects:
639-
* None.
640-
*
641-
*--------------------------------------------------------------------------
642-
*/
643-
644-
static int
645-
_mongoc_stream_tls_cork (mongoc_stream_t *stream)
646-
{
647-
mongoc_stream_tls_t *tls = (mongoc_stream_tls_t *)stream;
648-
649-
BSON_ASSERT (stream);
650-
651-
return mongoc_stream_cork (tls->base_stream);
652-
}
653-
654-
655-
/*
656-
*--------------------------------------------------------------------------
657-
*
658-
* _mongoc_stream_tls_uncork --
659-
*
660-
* The function is not supported on mongoc_stream_tls_t.
661-
*
662-
* Returns:
663-
* 0 always.
664-
*
665-
* Side effects:
666-
* None.
667-
*
668-
*--------------------------------------------------------------------------
669-
*/
670-
671-
static int
672-
_mongoc_stream_tls_uncork (mongoc_stream_t *stream)
673-
{
674-
mongoc_stream_tls_t *tls = (mongoc_stream_tls_t *)stream;
675-
676-
BSON_ASSERT (stream);
677-
678-
return mongoc_stream_uncork (tls->base_stream);
679-
}
680-
681-
682628
/*
683629
*--------------------------------------------------------------------------
684630
*
@@ -831,8 +777,6 @@ mongoc_stream_tls_new (mongoc_stream_t *base_stream,
831777
tls->parent.flush = _mongoc_stream_tls_flush;
832778
tls->parent.writev = _mongoc_stream_tls_writev;
833779
tls->parent.readv = _mongoc_stream_tls_readv;
834-
tls->parent.cork = _mongoc_stream_tls_cork;
835-
tls->parent.uncork = _mongoc_stream_tls_uncork;
836780
tls->parent.setsockopt = _mongoc_stream_tls_setsockopt;
837781
tls->parent.get_base_stream = _mongoc_stream_tls_get_base_stream;
838782
tls->weak_cert_validation = opt->weak_cert_validation;

src/mongoc/mongoc-stream.c

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -211,41 +211,6 @@ mongoc_stream_read (mongoc_stream_t *stream,
211211
}
212212

213213

214-
/**
215-
* mongoc_stream_cork:
216-
* @stream: (in): A mongoc_stream_t.
217-
*
218-
* Corks a stream, preventing packets from being sent immediately. This is
219-
* useful if you need to send multiple messages together as a single packet.
220-
*
221-
* Call mongoc_stream_uncork() after writing your data.
222-
*
223-
* Returns: 0 on success, -1 on failure.
224-
*/
225-
int
226-
mongoc_stream_cork (mongoc_stream_t *stream)
227-
{
228-
bson_return_val_if_fail(stream, -1);
229-
return stream->cork ? stream->cork(stream) : 0;
230-
}
231-
232-
233-
/**
234-
* mongoc_stream_uncork:
235-
* @stream: (in): A mongoc_stream_t.
236-
*
237-
* Uncorks a stream, previously corked with mongoc_stream_cork().
238-
*
239-
* Returns: 0 on success, -1 on failure.
240-
*/
241-
int
242-
mongoc_stream_uncork (mongoc_stream_t *stream)
243-
{
244-
bson_return_val_if_fail(stream, -1);
245-
return stream->uncork ? stream->uncork(stream) : 0;
246-
}
247-
248-
249214
int
250215
mongoc_stream_setsockopt (mongoc_stream_t *stream,
251216
int level,

src/mongoc/mongoc-stream.h

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,33 @@ BSON_BEGIN_DECLS
3434
typedef struct _mongoc_stream_t mongoc_stream_t;
3535

3636

37+
struct _mongoc_stream_t
38+
{
39+
int type;
40+
void (*destroy) (mongoc_stream_t *stream);
41+
int (*close) (mongoc_stream_t *stream);
42+
int (*flush) (mongoc_stream_t *stream);
43+
ssize_t (*writev) (mongoc_stream_t *stream,
44+
mongoc_iovec_t *iov,
45+
size_t iovcnt,
46+
int32_t timeout_msec);
47+
ssize_t (*readv) (mongoc_stream_t *stream,
48+
mongoc_iovec_t *iov,
49+
size_t iovcnt,
50+
size_t min_bytes,
51+
int32_t timeout_msec);
52+
int (*setsockopt) (mongoc_stream_t *stream,
53+
int level,
54+
int optname,
55+
void *optval,
56+
socklen_t optlen);
57+
mongoc_stream_t *(*get_base_stream) (mongoc_stream_t *stream);
58+
void *padding [8];
59+
};
60+
61+
3762
mongoc_stream_t *mongoc_stream_get_base_stream (mongoc_stream_t *stream);
3863
int mongoc_stream_close (mongoc_stream_t *stream);
39-
int mongoc_stream_cork (mongoc_stream_t *stream);
40-
int mongoc_stream_uncork (mongoc_stream_t *stream);
4164
void mongoc_stream_destroy (mongoc_stream_t *stream);
4265
int mongoc_stream_flush (mongoc_stream_t *stream);
4366
ssize_t mongoc_stream_writev (mongoc_stream_t *stream,

0 commit comments

Comments
 (0)