Closed Bug 1206465 Opened 9 years ago Closed 9 years ago

Remove ice_ctx from TestStunTcpServer

Categories

(Core :: WebRTC: Networking, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox43 --- affected
firefox44 --- fixed

People

(Reporter: drno, Assigned: drno)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

The TestStunTcpServer initializes an ice_ctx with TCP disabled, which gets written into the nICEr central shared registry. This results in single TCP test execution failing and currently the tests in ice_unittest having dependencies on each other.
Bug 1206465: removed ice_ctx from TestStunTcpServer. r?ekr,r?bwc
Attachment #8663362 - Flags: review?(ekr)
Attachment #8663362 - Flags: review?(docfaraday)
https://reviewboard.mozilla.org/r/19787/#review17855

There are some simplifications I'd like to see here.

::: media/mtransport/test/stunserver.cpp:394
(Diff revision 1)
> +  nr_socket *send_sock;
> +

Couldn't we just do if (!sock) {sock = send_sock_;}, and avoid the if/else below, and the extra variable?

::: media/mtransport/test/stunserver.cpp:591
(Diff revision 1)
> +void TestStunTcpServer::readable_cb(NR_SOCKET s, int how, void *cb_arg) {

I wonder how much we could simplify this by doing the following:

1) Adding virtual nr_socket\* GetSocket(NR_SOCKET s) to TestStunServer.
2) Making |connections\_| be a non-static member of TestStunTcpServer, as a std::map<NR_SOCKET, nr_socket\*> (so we can override GetSocket).
3) Unifying the two implementations of readable_cb, since the only real difference is now encapsulated in GetSocket()
4) Simplify (or eliminate) PreProcess since we don't need to have a conditional sock param.
5) Eliminate StunTcpReadOperation

::: media/mtransport/test/stunserver.cpp:592
(Diff revision 1)
> +  StunTcpReadOperation* ops = static_cast<StunTcpReadOperation*>(cb_arg);
> +  TestStunServer* server = ops->server_;

Inconsistent \*

::: media/mtransport/test/stunserver.cpp:595
(Diff revision 1)
> +  nr_socket* sock = static_cast<nr_socket *>(static_cast<nr_socket_wrapped *>(wrapped_sock->obj)->sock_);

Why do we need the static_cast<nr_socket\*> here? sock\_ is already an nr_socket\*. Also, inconsistent \*

::: media/mtransport/test/stunserver.cpp:596
(Diff revision 1)
> +  char message[4096];

Let's give this a constant a name, since it is used in two places now.
Attachment #8663362 - Flags: review?(docfaraday)
backlog: --- → webrtc/webaudio+
Rank: 15
Priority: -- → P1
Comment on attachment 8663362 [details]
MozReview Request: Bug 1206465: removed ice_ctx from TestStunTcpServer. r?bwc

Bug 1206465: removed ice_ctx from TestStunTcpServer. r?bwc
Attachment #8663362 - Attachment description: MozReview Request: Bug 1206465: removed ice_ctx from TestStunTcpServer. r?ekr,r?bwc → MozReview Request: Bug 1206465: removed ice_ctx from TestStunTcpServer. r?bwc
Attachment #8663362 - Flags: review?(ekr) → review?(docfaraday)
https://reviewboard.mozilla.org/r/19787/#review17855

> I wonder how much we could simplify this by doing the following:
> 
> 1) Adding virtual nr_socket\* GetSocket(NR_SOCKET s) to TestStunServer.
> 2) Making |connections\_| be a non-static member of TestStunTcpServer, as a std::map<NR_SOCKET, nr_socket\*> (so we can override GetSocket).
> 3) Unifying the two implementations of readable_cb, since the only real difference is now encapsulated in GetSocket()
> 4) Simplify (or eliminate) PreProcess since we don't need to have a conditional sock param.
> 5) Eliminate StunTcpReadOperation

Thanks, that was a good idea.
Comment on attachment 8663362 [details]
MozReview Request: Bug 1206465: removed ice_ctx from TestStunTcpServer. r?bwc

Bug 1206465: removed ice_ctx from TestStunTcpServer. r?bwc
Blocks: 1176382
Blocks: 1207451
Comment on attachment 8663362 [details]
MozReview Request: Bug 1206465: removed ice_ctx from TestStunTcpServer. r?bwc

Bug 1206465: removed ice_ctx from TestStunTcpServer. r?ekr,r?bwc
Attachment #8663362 - Attachment description: MozReview Request: Bug 1206465: removed ice_ctx from TestStunTcpServer. r?bwc → MozReview Request: Bug 1206465: removed ice_ctx from TestStunTcpServer. r?ekr,r?bwc
Attachment #8663362 - Flags: review?(ekr)
Bug 1207451: removed framing from multi_tcp API. r?bwc
Attachment #8664651 - Flags: review?(docfaraday)
Attachment #8664651 - Attachment is obsolete: true
Attachment #8664651 - Flags: review?(docfaraday)
It looks like you incorporated feedback, but the two subsequent pushes have undone all of the work.
Flags: needinfo?(drno)
Comment on attachment 8663362 [details]
MozReview Request: Bug 1206465: removed ice_ctx from TestStunTcpServer. r?bwc

Bug 1206465: removed ice_ctx from TestStunTcpServer. r?bwc
Attachment #8663362 - Attachment description: MozReview Request: Bug 1206465: removed ice_ctx from TestStunTcpServer. r?ekr,r?bwc → MozReview Request: Bug 1206465: removed ice_ctx from TestStunTcpServer. r?bwc
Attachment #8663362 - Flags: review?(ekr)
(In reply to Byron Campen [:bwc] from comment #9)
> It looks like you incorporated feedback, but the two subsequent pushes have
> undone all of the work.

Yea that subsequent push didn't go as intended.
Flags: needinfo?(drno)
Did you want me to try to review it as it stands now, or did you want to fix the push first?
Flags: needinfo?(drno)
(In reply to Byron Campen [:bwc] from comment #12)
> Did you want me to try to review it as it stands now, or did you want to fix
> the push first?

The push from comment #10 should have restored the good version from comment #6. So yes, please go ahead a review :-)
Flags: needinfo?(drno)
Comment on attachment 8663362 [details]
MozReview Request: Bug 1206465: removed ice_ctx from TestStunTcpServer. r?bwc

https://reviewboard.mozilla.org/r/19789/#review18435
Attachment #8663362 - Flags: review?(docfaraday) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/d990673dc675
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: