static void proxy_input(struct client *client)
{
struct istream *input;
+ struct ostream *output;
const char *line;
unsigned int duration;
return;
}
+ output = client->output;
+ o_stream_ref(output);
+ o_stream_cork(output);
while ((line = i_stream_next_line(input)) != NULL) {
if (client->v.proxy_parse_line(client, line) != 0)
break;
}
+ o_stream_uncork(output);
+ o_stream_unref(&output);
}
static int proxy_start(struct client *client,
static void server_input(struct login_proxy *proxy)
{
unsigned char buf[OUTBUF_THRESHOLD];
- ssize_t ret;
+ ssize_t ret, ret2;
proxy->last_io = ioloop_time;
if (o_stream_get_buffer_used_size(proxy->client_output) >
}
ret = net_receive(proxy->server_fd, buf, sizeof(buf));
- if (ret < 0)
+ if (ret < 0) {
login_proxy_free_errno(&proxy, errno, "server");
- else if (o_stream_send(proxy->client_output, buf, ret) != ret) {
+ return;
+ }
+ o_stream_cork(proxy->client_output);
+ ret2 = o_stream_send(proxy->client_output, buf, ret);
+ o_stream_uncork(proxy->client_output);
+ if (ret2 != ret) {
login_proxy_free_errno(&proxy,
proxy->client_output->stream_errno,
"client");
static void proxy_client_input(struct login_proxy *proxy)
{
unsigned char buf[OUTBUF_THRESHOLD];
- ssize_t ret;
+ ssize_t ret, ret2;
proxy->last_io = ioloop_time;
if (o_stream_get_buffer_used_size(proxy->server_output) >
}
ret = net_receive(proxy->client_fd, buf, sizeof(buf));
- if (ret < 0)
+ if (ret < 0) {
login_proxy_free_errno(&proxy, errno, "client");
- else if (o_stream_send(proxy->server_output, buf, ret) != ret) {
+ return;
+ }
+ o_stream_cork(proxy->client_output);
+ ret2 = o_stream_send(proxy->server_output, buf, ret);
+ o_stream_uncork(proxy->server_output);
+ if (ret2 != ret) {
login_proxy_free_errno(&proxy,
proxy->server_output->stream_errno,
"server");