return *return_reason = "WS_INIT", -1;
}
+ wstp->connected = time(NULL);
+
wstp->ws_initialized = 1;
self->tp_pre_framed = 1;
char const **return_why)
{
tport_ws_t *wstp = (tport_ws_t *)self;
-
- if (establish_logical_layer(&wstp->ws) < 0) {
- if (wstp->tos++ == 1) {
- tport_close(self);
- SU_DEBUG_7(("%s(%p): %s to " TPN_FORMAT "%s\n",
- __func__, (void *)self,
- "timeout establishing connection\n", TPN_ARGS(self->tp_name), ""));
- return -1;
+ int ll = establish_logical_layer(&wstp->ws);
+ int punt = 0;
+
+ if (ll == -1) {
+ punt = 1;
+ } else if (ll < 0) {
+ time_t now = time(NULL);
+ if (now - wstp->connected > 5) {
+ punt = 2;
}
} else {
- self->tp_params->tpp_keepalive = 30000;
+ self->tp_params->tpp_keepalive = 0;
}
+ if (punt) {
+ tport_close(self);
+
+ SU_DEBUG_7(("%s(%p): %s to " TPN_FORMAT "%s\n",
+ __func__, (void *)self,
+ (punt == 2 ? "Timeout establishing SSL" : "Error establishing SSL"), TPN_ARGS(self->tp_name), ""));
+
+ return -1;
+ }
+
+
return
tport_next_recv_timeout(self, return_target, return_why) |
tport_next_keepalive(self, return_target, return_why);