File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ static int conn_create_dgram_bio(BIO *b, BIO_CONNECT *c)
110
110
111
111
static int conn_state (BIO * b , BIO_CONNECT * c )
112
112
{
113
- int ret = -1 , i ;
113
+ int ret = -1 , i , opts ;
114
114
BIO_info_cb * cb = NULL ;
115
115
116
116
if (c -> info_callback != NULL )
@@ -188,8 +188,12 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
188
188
case BIO_CONN_S_CONNECT :
189
189
BIO_clear_retry_flags (b );
190
190
ERR_set_mark ();
191
- ret = BIO_connect (b -> num , BIO_ADDRINFO_address (c -> addr_iter ),
192
- BIO_SOCK_KEEPALIVE | c -> connect_mode );
191
+
192
+ opts = c -> connect_mode ;
193
+ if (BIO_ADDRINFO_socktype (c -> addr_iter ) == SOCK_STREAM )
194
+ opts |= BIO_SOCK_KEEPALIVE ;
195
+
196
+ ret = BIO_connect (b -> num , BIO_ADDRINFO_address (c -> addr_iter ), opts );
193
197
b -> retry_reason = 0 ;
194
198
if (ret == 0 ) {
195
199
if (BIO_sock_should_retry (ret )) {
You can’t perform that action at this time.
0 commit comments