Skip to content

Commit

Permalink
fix order of evaluation / changed rawBuf() return type to unsigned
Browse files Browse the repository at this point in the history
  • Loading branch information
radkesvat committed Mar 28, 2024
1 parent 069c190 commit 668e47d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tunnels/client/http2/http2_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,15 @@ static int on_frame_recv_callback(nghttp2_session *session,
break;
}

if (frame->hd.type & NGHTTP2_HEADERS == NGHTTP2_HEADERS)
if ((frame->hd.type & NGHTTP2_HEADERS) == NGHTTP2_HEADERS)
{
if (frame->headers.cat == NGHTTP2_HCAT_RESPONSE)
{
http2_client_child_con_state_t *stream = nghttp2_session_get_stream_user_data(con->session, frame->hd.stream_id);
con->handshake_completed = true;
flush_write_queue(con);
}
else if (frame->hd.flags & HTTP2_FLAG_END_STREAM == HTTP2_FLAG_END_STREAM)
else if ((frame->hd.flags & HTTP2_FLAG_END_STREAM) == HTTP2_FLAG_END_STREAM)
{
http2_client_child_con_state_t *stream = nghttp2_session_get_stream_user_data(con->session, frame->hd.stream_id);
context_t *fin_ctx = newFinContext(stream->line);
Expand Down
2 changes: 1 addition & 1 deletion ww/managers/node_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static void cycleProcess()
bool found = false;
c_foreach(n1, map_node_t, state->node_map)
{
if (n1.ref->second->metadata.flags & TFLAG_ROUTE_STARTER == TFLAG_ROUTE_STARTER)
if ((n1.ref->second->metadata.flags & TFLAG_ROUTE_STARTER) == TFLAG_ROUTE_STARTER)
{
found = true;
n1.ref->second->route_starter = true;
Expand Down
6 changes: 3 additions & 3 deletions ww/shiftbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extern size_t bufLen(shift_buffer_t *self);
extern void setLen(shift_buffer_t *self, size_t bytes);
extern void reserve(shift_buffer_t *self, size_t bytes);
extern void consume(shift_buffer_t *self, size_t bytse);
extern char *rawBuf(shift_buffer_t *self);
extern unsigned char *rawBuf(shift_buffer_t *self);

void destroyShiftBuffer(shift_buffer_t *self)
{
Expand Down Expand Up @@ -73,7 +73,7 @@ void expand(shift_buffer_t *self, size_t increase)
size_t new_realcap = pow(2, ceil(log2((float)(realcap * 2) + (increase * 2))));
self->pbuf = malloc(new_realcap);
size_t dif = (new_realcap / 2) - self->cap;
memcpy(&(self->pbuf[dif]), &(old_buf[0]), realcap);
memcpy(&(self->pbuf[dif]), &(old_buf[0]), realcap);
self->curpos += dif;
self->lenpos += dif;
self->cap = new_realcap / 2;
Expand Down Expand Up @@ -113,7 +113,7 @@ void shiftr(shift_buffer_t *self, size_t bytes)
self->curpos += bytes;
}

void writeRaw(shift_buffer_t *self, char *buffer, size_t len)
void writeRaw(shift_buffer_t *self, unsigned char *buffer, size_t len)
{
memcpy(rawBuf(self), buffer, len);
}
Expand Down
4 changes: 2 additions & 2 deletions ww/shiftbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ inline void consume(shift_buffer_t *self, size_t bytes)
setLen(self, bufLen(self) - bytes);
}

inline char *rawBuf(shift_buffer_t *self) {return &(self->pbuf[self->curpos]); }
inline unsigned char *rawBuf(shift_buffer_t *self) {return &(self->pbuf[self->curpos]); }



void writeRaw(shift_buffer_t *self, char* buffer, size_t len);
void writeRaw(shift_buffer_t *self, unsigned char* buffer, size_t len);

void writeI32(shift_buffer_t *self, int32_t data);
void writeUI32(shift_buffer_t *self, uint32_t data);
Expand Down

0 comments on commit 668e47d

Please sign in to comment.