pike.git / lib / modules / SSL.pmod / Connection.pike

version» Context lines:

pike.git/lib/modules/SSL.pmod/Connection.pike:599:   //!   //! @returns   //! Returns the number of times @[to_write()] can be called before   //! it stops returning non-empty strings.   int query_write_queue_size()   {    return sizeof(alert_q) + sizeof(urgent_q) + sizeof(application_q);   }      //! Extracts data from the packet queues. Returns a string of data - //! to be written, "" if there are no pending packets, 1 of the + //! to be written, 0 if there are no pending packets, 1 of the   //! connection is being closed politely, and -1 if the connection   //! died unexpectedly.   //!   //! This function is intended to be called from an i/o write callback.   //!   //! @seealso   //! @[query_write_queue_size()], @[send_streaming_data()].   string|int to_write()   {    if (state & CONNECTION_local_fatal)    return -1;       Packet packet = [object(Packet)](alert_q->get() || urgent_q->get() ||    application_q->get()); -  if (!packet) { -  return (state & CONNECTION_local_closing) ? 1 : ""; -  } +  if (!packet) +  return !!(state & CONNECTION_local_closing);       SSL3_DEBUG_MSG("SSL.Connection: writing packet of type %d, %O\n",    packet->content_type, packet->fragment[..6]);    if (packet->content_type == PACKET_alert)    {    if (packet->level == ALERT_fatal) {    state = [int(0..0)|ConnectionState](state | CONNECTION_local_fatal |    CONNECTION_peer_closed);    // SSL3 5.4:    // Alert messages with a level of fatal result in the immediate